J
JimP
How can I structure code or a query to find the minimum and maximum [Year]
and [MthNbr] for each [CustID], one record per [CustID], e.g.
Table1
[CustID] [Year] [MthNbr]
1 2004 7
1 2005 9
1 2006 3
2 2005 2
2 2006 8
2 2007 4
Query Results
[CustID] [MinYear] [MinMthNbrForMinYear] [MaxYear]
[MaxMthNbrForMaxYear]
1 2004 7
2006 3
2 2005 2
2007 4
and [MthNbr] for each [CustID], one record per [CustID], e.g.
Table1
[CustID] [Year] [MthNbr]
1 2004 7
1 2005 9
1 2006 3
2 2005 2
2 2006 8
2 2007 4
Query Results
[CustID] [MinYear] [MinMthNbrForMinYear] [MaxYear]
[MaxMthNbrForMaxYear]
1 2004 7
2006 3
2 2005 2
2007 4