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
Titre:
Query assistance
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01108620
Message ID:
01108620
Vues:
41
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform