Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting first record
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00633484
Message ID:
00633564
Vues:
19
>>>>>What is the easiest way to select the first record based on a single field?
>>>>
>>>>See SELECT TOP 1 ...
>>>
>>>I should have given a better explanation of what I am looking for.
>>>
>>>If I have several records for companyA and several records for companyB and several for companyC, what is the easiest way to select the first record for each company?
>>
>>You've to provide a definition of the first record in terms of the table fields.
>
>Here is the list of fields in the table. The only fields that will contain duplicate values are dc_id and dc_nme.
>
>dc_id
>prd_id_suf
>invc_dsc
>dc_nme
>new_id
>new_date
>prev_id
>ship_dte

Hi Tom,

Sql Server doesn't have a concept of the first or the last record. You have to define what is the first record. For example, it could be a record with the earliest new_date.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform