Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query Question
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01397059
Message ID:
01397075
Views:
49
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform