Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query assistance
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01108620
Message ID:
01108773
Vues:
14
Rich,
Well it is is acctually a datetime field so the odds of that are relatively small, but if there were two records with the same date I would not really care which one I got because they represents the same instance of a physical object.

Einar

>What result would you want if more than one record with the same FK had the same date?
>
>>I need a little help with a query. Assume I have the following table:
>>
>>
>>pk    fk     date
>>--    --     ----
>>1     1      1/1/1976
>>2     2      1/2/1976
>>3     2      1/1/1969
>>4     1      1/15/1976
>>5     1      1/15/2006
>>6     1      8/10/1989
>>7     2      12/25/2005
>>.
>>.
>>.
>>
>>
>>In my result set I would like 2 records per unique FK, one record is the min date and the other record is the max date. For the example above the result would look something like this:
>>
>>
>>pk    fk     date
>>--    --     ----
>>1     1      1/1/1976
>>3     2      1/1/1969
>>5     1      1/15/2006
>>7     2      12/25/2005
>>
>>
>>Is what I am asking possible? Would I be able to use UNION (first get all the min dates and then all the max dates)?
>>
>>Thanks,
>>Einar
Semper ubi sub ubi.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform