Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql statement problem
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Sql statement problem
Divers
Thread ID:
00678842
Message ID:
00678842
Vues:
58
I am having difficulty in using my sql statement. What I have is a table that has supervisor, vehicle number, mileage, assign date. I have a form where the user puts in starting assign date and ending assign date. Both dates a looking at a_startdate. What I am trying to do is group supervisor by their a_vin which would look the following
sup1 veh1 100 200 100 someavg someunit
sup1 veh2 100 300 200 someavg someunit
sup2 veh3 100 200 100 someavg someunit
sup2 veh4 100 200 100 someavg someunit
sup2 veh5 100 200 100 someavg someunit
.....
sup9 veh20 20  40  20 someavg someunit
I think I am missing something below and I can't seem to rig it the right way
days = (.todate.value-.fromdate.value)*30

SELECT a_id, a_sup, a_vin, MIN(a_startmile) as begin, MAX(a_startmile) as end, ;
	MIN(a_startmile)-MAX(a_startmile) as totalmile, ;
       (MIN(a_startmile)-MAX(a_startmile))/days as average, ;
	a_unit as unit FROM veh_assign_tbl ;
GROUP BY a_sup WHERE BETWEEN(a_startdate, .fromdate.value, .todate.value) ;
INTO CURSOR test
	brows
Can anyone see something wrong here?

Thanks
Nick Patel
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform