Top "Case-when" questions

Use this tag only for SQL queries with case expressions.

how use SQL WHERE CASE with NOT IN or equals at the same time?

Hi all (my first post on the Stack!), This works: where Tran_date between @FromDate and @ToDate and Range = @Range …

sql sql-server tsql case-when in-operator
Execution order of WHEN clauses in a CASE statement

Given the following body of a case statement: 1 WHEN r.code= '00' then 'A1' 2 WHEN r.code ='01…

sql case sybase case-when
How to use a case-when statement in a mysql stored procedure?

I want to set the session_id automatically using the request_time parameter so i opted for a mysql stored …

mysql timestamp procedures case-when
How to return true or false from tsql using case when

I'm trying to return true or false based on a CASE WHEN THEN tsql statement, but the only thing that …

tsql case-when
how to put nested case-when condition in postgresql query

i want to write nested case when condition in query to store the value that will come from one case …

postgresql if-statement nested case-when
can we use CASE with EXEC

I want to select a stored proc to execute based on user input. Something like - EXEC CASE @InputParam WHEN …

sql-server case-when
Select case comparing two columns

I would like to have a query that uses the greater of two values/columns if a certain other value …

sql sql-server tsql select case-when
Sum(Case when) resulting in multiple rows of the selection

I have a huge table of customer orders and I want to run one query to list orders by month …

postgresql sum case-when
How to rewrite the CASE statement into an SSIS expression?

I have the following SQL query that I need to use in a Derived Column Transformation available in SSIS. CASE …

sql ssis case-when
How to ORDER BY CASE in Doctrine2 (Symfony2)

I want to run this query by using Doctrine in Symfony 2.3. But it seems like Doctrine does not understand CASE …

php mysql symfony doctrine-orm case-when