declare @t table(X int, Y int, DATE CHAR(8))
insert @t values
(1, 20, '20120101' ),
(1, 21, '20120101' ),
(2, 30, '20120201'),
(3, 40, '20120201'),
(3, 41, '20120301')
select x,y, date, maxy, miny from
(
select *, max(date) over (partition by x) maxdate,
min(date) over (partition by x) mindate
from @t
) a
where mindate <> maxdate