Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query Question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01397059
Message ID:
01397075
Vues:
50
>>Any way to do this in a query?
>>
>I can't figure out how to do it with a single SQL Query
>
>This works but oh so NOT elegant:
>
>SELECT *,0000 as grouper FROM tickets INTO CURSOR c_tickets order by ticket READWRITE
>LOCAL lnGrouper
>lnGrouper=1
>SELECT c_tickets
>SCATTER MEMVAR
>SCAN ALL
>	IF status<>m.status or booknumber<>m.booknumber
>		lnGrouper=lnGrouper+1
>	ENDIF
>	replace grouper WITH lnGrouper IN c_tickets
>	SCATTER MEMVAR
>ENDSCAN
>
>select booknumber,status, min(ticket),max(ticket) ;
>	from c_tickets ;
>	group by booknumber,grouper
>
>
If you're doing scan solution, you don't really need extra select at the end, you can do all the work in one SCAN.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform