Question : sql query help

my table has
ID      status      Year       Month
1288      GG      2005      1
1289      GG      2004      7
1290      GG      2003      1
1291      GG      2003      5
1292      GG      2003      8
1294      GG      2003      4
999      GG      2001      2
1295      GG      2001      10
1296      GG      2002      4
1297      GG      2002      5


I want to get Begin month begin year end month end year where status='GG"
so I my example
begin month=2 begin year 2001
end month=7 end year =2004
please help

Answer : sql query help

Perhaps something like this?

~bp
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
SELECT Status,
       MIN (
          CONVERT (
             DATETIME,
               CONVERT (CHAR (4), [Year])
             + '/'
             + CONVERT (CHAR (2), [Month])
             + '/01')),
       MAX (
          CONVERT (
             DATETIME,
               CONVERT (CHAR (4), [Year])
             + '/'
             + CONVERT (CHAR (2), [Month])
             + '/01'))
  FROM Table3
 WHERE Status = 'GG'
GROUP BY Status;
Random Solutions  
 
programming4us programming4us