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;
|