I need to get alldata whereclause in sql?
3 answers
select count(page) as TARIH,
(datepart(hour,Date)*60+datepart(minute,Date))/@countgap as SIRA
from scr_SecuristLog
where
Date between @date1 and @date2
and
(
(@page is not null and Page=@page)
or (@page is null and @page=@page)
)
will return all data between date 1 and date 2 and only data equal to the parameter, or if the parameter is null, all data between date 1 and date2 will be returned
0
a source to share