Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL group by syntax
Message
 
To
21/09/1996 11:09:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00008348
Message ID:
00008351
Views:
37
>Is it possible that by default a command like this will always return the highest date?
>
>SELECT * FROM table GROUP BY field ORDER BY date DESCENDING

I think it will just order the resulting query by date.
When grouping, VFP implementation of SQL seems to pick the last
physical record that match the grouping condition.

If you havent found other solution (of course different than
making a program for that), you might wanna try something like
this:

1) Create a cursor that have highest dates first for each
group of field1:
select * from Table1 order by field1,date1 desc into cursor xxx

2) Create an old unique index (ok i know this is a cheap trick :))
index on field1 to xxx unique

in cursor xxx you must have what you need.

HTH,

J. Luis
J. Luis Santiago Rodríguez.• CADIS • E-mail: jlsantiago@iserve.net.mx• Ciudad de México.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform