I need to get alldata whereclause in sql?

I need to take all data, if Page! = @ Page, get AllDATA

select the account (page) as TARIH,
  (datepart (hour, date) * 60 + datepart (minute, date)) / @ countgap as SIRA
  from scr_SecuristLog
  where Date from @ date1 and @ date2 and Page = @page or Page = AllDATA

-1


a source to share


3 answers


try:



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=@page or Page = AllDATA)

      

+1


a source


Solution: select account (page) as TARIH,
  (datepart (hour, date) * 60 + datepart (minute, date)) / @ countgap as SIRA
  from scr_SecuristLog
  where Date is between @ date1 and @ date2 and (Page = @page or @ page = 'Tüm Kullanıcılar')



0


a source


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







All Articles