Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL group by syntax
Message
De
24/09/1996 06:46:18
 
 
À
21/09/1996 11:04:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00008348
Message ID:
00008472
Vues:
33
>I have a SQL that extract a specific set of datas from a table. One of my field extracted can occur more than once. I would like my SQL to only extract unique occuring of that field. So, this bring us to SELECT * FROM table GROUP BY field1.
>
>But, I would like to be able to only keep the occurence of field1 which contain the highest date. Is there a syntax that will allow me to do something like this: SELECT * FROM table GROUP BY 1 ORDER BY date DESCENDING KEEP THE HIGHEST ONE.
>
>I think you got the point. :)
>
>Any idea?

Hi, I haven't read all the answers yet, so maybe this idea has been posted, anyway, this works:

Select Distinct(cCol1), CToD(Right(Max(cCol1+DToc(dCol2)),8)) As dCol3
From table1
Group By cCol1

HTH,

Alex.
Alexandre Nobre
Alpha Bytes Computer Corp.

Did you know that there are innocent people dying in East Timor?
It helps if you do...

I suppose you don't need glasses if you're able to read this line

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform