About 53 results
Open links in new tab
  1. sql - Case in Select Statement - Stack Overflow

    Jan 7, 2013 · I have an SQL statement that has a CASE from SELECT and I just can't get it right. Can you guys show me an example of CASE where the cases are the conditions and the results are from …

  2. SQL Case Expression Syntax? - Stack Overflow

    Aug 7, 2008 · case expression is the correct term as they evaluate to a scalar value (also. in SQL a statement is terminated by the "statement terminator" which is the semi-colon).

  3. 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. Is th...

  4. SQL Server CASE .. WHEN .. IN statement - Stack Overflow

    May 18, 2011 · On SQL server 2005 I am trying to query this select statement SELECT AlarmEventTransactionTableTable.TxnID, CASE AlarmEventTransactions.DeviceID WHEN …

  5. SQL CASE WHEN with multiple AND and OR - Stack Overflow

    Aug 22, 2018 · Can you please tell me if SQL code below makes sense. I am using multiple ANDs and OR in CASE WHEN. Thanks for your help! SELECT id, period, CASE WHEN state = 'group8' AND …

  6. sql - Can I use CASE expressions in a JOIN condition? - Stack Overflow

    The following image is a part of Microsoft SQL Server 2008 R2 System Views. From the image we can see that the relationship between sys.partitions and sys.allocation_units depends on the value of sys.

  7. sql - Case statement with 'OR' statement - Stack Overflow

    Oct 25, 2012 · Note that in SQL, string comparison is case-insensitive by default. You can alter the default by setting a case-sensitive database collation, but that's fairly unusual.

  8. SQL Switch/Case in 'where' clause - Stack Overflow

    SQL Switch/Case in 'where' clause Asked 17 years, 6 months ago Modified 3 years, 2 months ago Viewed 797k times

  9. Execution order of WHEN clauses in a CASE statement

    Jul 2, 2014 · Then I read statements like ' SQL is a declarative language, meaning that it tells the SQL engine what to do, not how ' in Order Of Execution of the SQL query and wonder if this also relates …

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

    Jul 27, 2010 · I have a huge query which uses case/when often. Now I have this SQL here, which does not work. (select case when xyz.something = 1 then 'SOMETEXT' else (select case when …