About 597,000 results
Open links in new tab
  1. SQL Case Expression Syntax? - Stack Overflow

    Aug 7, 2008 · Link: CASE (Transact-SQL) Also note that the ordering of the WHEN statements is important. You can easily write multiple WHEN clauses that overlap, and the first one that …

  2. Best way to do nested case statement logic in SQL Server

    I'm writing an SQL Query, where a few of the columns returned need to be calculated depending on quite a lot of conditions. I'm currently using nested case statements, but its getting messy. …

  3. sql - can you do an ELSE WHEN on a CASE - Stack Overflow

    Nov 4, 2011 · No, ELSE is a catch-all. In your example, it's not clear why you would want to include a condition in the ELSE clause, since you've already checked the logically opposite …

  4. How do I perform an IF...THEN in an SQL SELECT?

    Sep 15, 2008 · SELECT CASE WHEN Obsolete = 'N' or InStock = 'Y' THEN 1 ELSE 0 END as Saleable, * FROM Product CASE statements can be embedded in other CASE statements …

  5. CASE .. WHEN expression in Oracle SQL - Stack Overflow

    I would add ELSE status before END so if a new status does creep in you get the base status value rather than a null for STATUSTEXT. I would not default to ELSE 'active' in case a new …

  6. SQL CASE WHEN or IF ELSE IF - Stack Overflow

    Sep 6, 2014 · SQL CASE WHEN or IF ELSE IF Asked 11 years, 2 months ago Modified 6 years, 1 month ago Viewed 83k times

  7. Nested CASE Statement With ELSe (SQL Server) - Stack Overflow

    Feb 26, 2015 · Nested CASE Statement With ELSe (SQL Server) Asked 10 years, 9 months ago Modified 10 years, 9 months ago Viewed 104k times

  8. T-SQL CASE Clause: How to specify WHEN NULL - Stack Overflow

    I wrote a T-SQL Statement similar like this (the original one looks different but I want to give an easy example here): SELECT first_name + CASE last_name WHEN null THEN 'Max' ELSE …

  9. How do I use T-SQL's Case/When? - Stack Overflow

    Jul 27, 2010 · The original query has multiple SELECT statements, so MS SQL server is expecting subqueries. It an easy mistake to make if you're used to some programming …

  10. sql - CASE statement to do nothing - Stack Overflow

    Jun 14, 2016 · The difference is you can't use CASE like IF/ELSE in other languages, because it's not a statement on it's own. Instead, you must have another statement that uses CASE …