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: mohammed qasem
  Where is mohammed qasem?
 amman
 Jordan
 mohammed qasem
 Tags
Subject: RE: table
Thread ID: 288952 Message ID: 288960 # Views: 39 # Ratings: 2
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Monday, December 27, 2010 11:36:15 AM         
   


> hi all,
> i need help to create new table as..attachment
>
> attachment have 2 small tables,
>
> thanks
>
>
> https://www.foxite.com/uploads/0fa38a82-0953-4a58-bcdf-c885021989d6.rar

I think this is close to what you want (it was not clear):

Select ;
	column5, ;
	column6, ;
	SUM(Iif(column7='2005,2006',Total_cfil,0)) As 'Y1', ;
	SUM(Iif(column7='2007',Total_cfil,0)) As 'Y2', ;
	SUM(Iif(column7='2008',Total_cfil,0)) As 'Y3', ;
	SUM(Iif(column7='2009',Total_cfil,0)) As 'Y4' ;
	FROM Mucurt ;
	GROUP By column5, column6 ;
	INTO cursor pass1
	
SELECT t1.f1, f2,f3,f4,f5,f6,f7,f8,f9,f10,;
f11, f12,f13,f14,f15,f16,f17,f18,f19,f20,;
f21, f22,f23,f24,f25,f26,f27,f28 ;
FROM ;
(Select ;
	column5 As f1, ;
	column6 As f2, ;
	'2005,2006' As f3, Y1 As f4, ;
	'2007' As f5, Y2 As f6, ;
	'2008' As f7, Y3 As f8, ;
	'2009' As f9, Y4 As f10 ;
	FROM pass1 ;
	WHERE column6 = 'A') t1 ;
INNER JOIN ;
(Select ;
	column5 As f1, ;
	column6 As f11, ;
	'2005,2006' As f12, Y1 As f13, ;
	'2007' As f14, Y2 As f15, ;
	'2008' As f16, Y3 As f17, ;
	'2009' As f18, Y4 As f19 ;
	FROM pass1 ;
	WHERE column6 = 'B') t2 ON t1.f1 = t2.f1 ;
INNER JOIN ;
(Select ;
	column5 As f1, ;
	column6 As f20, ;
	'2005,2006' As f21, Y1 As f22, ;
	'2007' As f23, Y2 As f24, ;
	'2008' As f25, Y3 As f26, ;
	'2009' As f27, Y4 As f28 ;
	FROM pass1 ;
	WHERE column6 = 'C') t3 ON t1.f1 = t3.f1 ; 
	INTO CURSOR myTab
	


Cetin Basoz

.Net has got better.Think about moving - check my blog:
Blog (main)
Blog (mirror)

ENTIRE THREAD

table Posted by mohammed qasem @ 12/27/2010 9:18:01 AM
RE: table Posted by Cetin Basoz @ 12/27/2010 11:36:15 AM
RE: table Posted by mohammed qasem @ 12/27/2010 12:25:42 PM
RE: table Posted by mohammed qasem @ 12/27/2010 1:41:29 PM