Link to home
Start Free TrialLog in
Avatar of dkilby
dkilbyFlag for Canada

asked on

ms sql + a conditional where statement

Is it possible to have a conditional where statement if so how.

ie if a value in the select statement equals a something then the part of the where statement would equal one thing if not another

this is what i tried.
WHERE completed = 1
AND CASE WHEN touch_reason in (19,20) THEN
DATEDIFF(hour, cdol.maxdate , getDate()) > 12
ELSE
DATEDIFF(hour, cdol.maxdate , getDate()) > 0
END
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
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 dkilby

ASKER

thank you - worked great
dkilby,

You're welcome :)

Regards,

Patrick