Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to grab the first record within each group?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00638707
Message ID:
00638799
Vues:
19
Hi Tim,

Thank you very much for your fast response! I'm curious how you had such good advice at the tip of your fingers? Have you struggled with this issue before?

The suggestion(s) you referenced work, but are surprisingly slow. Although not portable to a stored procedure syntax, I've found that (depending on one's data) its significantly faster to query for a cursor of duplicates and then manually walk this set of records either deleting all members but the first of each group, or copying the first record of each group to a final form cursor.

Any thoughts on my performance hack? Perhaps I'm missing something obvious?

Again, thanks again for your posting.

Malcolm


>See the following Google Thread:
>
>http://groups.google.com/groups?hl=en&ie=ISO-8859-1&oe=ISO-8859-1&threadm=372A0FA7.49BF291C%40elucidex.com&rnum=1&prev=/groups%3Fhl%3Den%26ie%3DISO-8859-1%26oe%3DISO-8859-1%26q%3DContactPersonsName%26btnG%3DGoogle%2BSearch%26meta%3Dgroup%253Dmicrosoft.public.sqlserver.*
>
>>Is there a way, using a SQL query, to grab the first record within each group of records in a SQL query?
>>
>>I currently have the need to grab just the first record within each group of records where a group of records is defined by a SQL 'group by' clause and where a 'order by' clause determines what which record floats to the top of each group.
>>
>>Thank you!
>>Malcolm Greene
>>Brooks-Durham
Malcolm Greene
Brooks-Durham
mgreene@bdurham.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform