Sql switch statement in where clause

So, if you need to check if a date is from last month, use the second calculation to get the first date, and the first calculation to get the last date of that range, and then use the usual greater-than-or-equal-to for the first, and less-than for the end, and you have it. You can't vote in polls. Answered by: And so forth...

Case statement in Where Clause SQL SERVER

If these expressions are equivalent, the expression in the THEN clause will be returned. Sign in to vote. I don't think I want to change my table structure to just use a switch statement. Sign up here and we'll keep you posted: Try this it wouldn't let me include the symbol - you will have to correct it if you want to test it: To whoever reads this answer: Optional Password.

Sign up here and we'll keep you posted:.

sql switch statement in where clause

Dillie-O Dillie-O 23. You can't delete your own topics.

You can't post new topics. SQL Editor. By continuing to browse this site, you agree to this use. Sign up or log in Sign up using Google. Please try this query.

CASE (Transact-SQL)

SQL Server. How to use case clause in where clause of update statement.

sql switch statement in where clause

I think the reply from frfernan is your best bet. Your question doesn't seem to be clear.

sql switch statement in where clause

Hot Network Questions. In the first example, the value in the SalariedFlag column of the HumanResources.

sql switch statement in where clause

Company About Careers Blog. GSquared Posted 8 years ago 1213448. Lukek Lukek 839 6 6.