Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL about one field
Message
From
05/01/2007 07:47:26
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL about one field
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01182738
Message ID:
01182738
Views:
63
Dear Expert

Table1 has two fields as
date d(8)
no n(1)

Field no has numbers from 1 to 9
I am making a SQL to sum different type of vehicles.

Please make following SQL enable to show correct data
select date1,;
	sum(iif(no = 1, no, $0)) as truck,;
	sum(iif(no = 2, no, $0)) as trolly,;
	sum(iif(no = 3, no, $0)) as troller,;
	sum(iif(no = 4, no, $0)) as ttroler,;
	sum(iif(no = 5, no, $0)) as tanker,;
	sum(iif(no = 6, no, $0)) as bcart,;
	sum(iif(no = 7, no, $0)) as ccart,;
	sum(iif(no = 8, no, $0)) as dcart,;
	sum(iif(no = 9, no, $0)) as other,;
	count(no) as veh,;
	from table1;
	group by 1;
	into table tmp
Next
Reply
Map
View

Click here to load this message in the networking platform