Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL about one field
Message
De
05/01/2007 07:47:26
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
SQL about one field
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01182738
Message ID:
01182738
Vues:
64
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform