Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 To: Michael Landrup
  Where is Michael Landrup?
 
 Vietnam
 Michael Landrup
 Tags
Subject: RE: how to synthetic data?
Thread ID: 345281 Message ID: 345318 # Views: 60 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Tuesday, May 22, 2012 1:45:29 PM         
   


> I have 3 tables of data as shown below. I want a summary of them as only three tables sum up the difference. ask experts for help. thank you very much!
>

There is no single aggregate function in VFP to do that directly but anyway you could work around with a custom UDF. ie:

Select Nvl(Nvl(cn1.Code,cn2.Code),cn3.Code) As 'code', ;
	concat( cn1.Value, cn2.Value, cn3.Value ) As 'value' ;
	from cn1 ;
	full Join cn2 On cn1.Code = cn2.Code or cn2.Code = cn3.Code ;
	full Join cn3 On cn2.Code = cn3.Code or cn1.Code = cn3.Code

Procedure Concat(tcVal1, tcVal2, tcVal3)
	tcVal1 = Nvl(m.tcVal1,' ')
	tcVal2 = Nvl(m.tcVal2,' ')
	tcVal3 = Nvl(m.tcVal3,' ')

	Return Cast(Chrtran(Alltrim(Trim(m.tcVal1) + ;
		Iif( m.tcVal2 = m.tcVal1 or m.tcVal2 = ' ', '', ' '+Trim(m.tcVal2) ) + ;
		Iif( m.tcVal3 = m.tcVal2 Or m.tcVal3 = m.tcVal1 or m.tcVal3 = ' ', '', ' '+Trim(m.tcVal3) )),' ','/') As c(5))
Endproc





Cetin Basoz

.Net has got better.Think about moving - check my blog:
My Blog
Blog (mirror) - sounds to be down


Support Wikipedia

ENTIRE THREAD

how to synthetic data? Posted by Michael Landrup @ 5/22/2012 6:24:11 AM
RE: how to synthetic data? Posted by Anders Altberg @ 5/22/2012 12:46:23 PM
RE: how to synthetic data? Posted by Cetin Basoz @ 5/22/2012 1:45:29 PM
RE: how to synthetic data? Posted by Michael Landrup @ 5/22/2012 4:11:34 PM
RE: how to synthetic data? Posted by Cetin Basoz @ 5/22/2012 7:04:29 PM
RE: how to synthetic data? Posted by Michael Landrup @ 5/23/2012 6:30:58 AM
RE: how to synthetic data? Posted by Cetin Basoz @ 5/23/2012 11:29:30 AM
RE: how to synthetic data? Posted by onytoo @ 5/22/2012 6:20:15 PM
RE: how to synthetic data? Posted by Michael Landrup @ 5/23/2012 4:21:42 AM
RE: how to synthetic data? Posted by Anders Altberg @ 5/23/2012 8:25:22 PM
RE: how to synthetic data? Posted by Michael Landrup @ 5/24/2012 5:21:22 AM