Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL group by syntax
Message
 
À
21/09/1996 11:09:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00008348
Message ID:
00008351
Vues:
35
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform