Link to home
Start Free TrialLog in
Avatar of erikTsomik
erikTsomikFlag for United States of America

asked on

sql DateDiff help

I need to show the record that is 24 hours priors of session start.

CASE WHEN isNULL(s.repost,0) = 1 
		THEN 
			DateDiff(hh,SU.sessionStart,GETDATE()) 
		ELSE 
			datediff(d, getdate(), SU.sessionStart) 
		END
 >= CASE WHEN isNULL(s.repost,0) = 1 
		THEN 
			24
		ELSE 
			3
		END 

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PortletPaul
I'm sorry but I don't understand the question as the sql in the question make no sense from line 7 onward

Please remember that THE BEST WAY TO ASK  is to provide:

a. sample data
b. the expected result

If we understand the question easily you get an answer faster and you don't need to clarify the question for us.
select ...
where dateadd(d,1,SU.sessionStart) >= getdate()
erikTsomik, do you still need help with this question?