テーブル内の使用可能なデータの列をこのクエリに追加するにはどうすればよいですか? evnt_dat
列と列を追加したいevnt_desrp
。
SELECT DISTINCT
ROW_NUMBER() OVER (ORDER BY
panel_descrp
, cardno
, lname
) rid
, panel_descrp
, cardno
, lname
FROM ev_log
where evnt_descrp = 'local grant'
and datepart(yyyy,EVNT_DAT) = datepart(yyyy,GETDATE())
and DATEPART(mm,evnt_dat) = DATEPART(mm,getdate()) -1
and DATEPART(dd,evnt_dat) >= 1 and DATEPART(dd,evnt_dat)<=2
GROUP BY
panel_descrp
, cardno
, lname