Top "Case" questions

In SQL, the CASE expression evaluates a list of conditions, returning the result for the first condition which evaluates to true.

Postgres CASE in ORDER BY using an alias

I have the following query which works great in Postgres 9.1: SELECT users.id, GREATEST( COALESCE(MAX(messages.created_at), '2012…

sql postgresql sql-order-by aggregate-functions case
How can I invert the case of a String in Java?

I want to change a String so that all the uppercase characters become lowercase, and all the lower case characters …

java string case case-sensitive
Using string representations of enum values in switch-case

Why is it not possible to use enum values as strings in a switch case? (Or what is wrong with …

java enums switch-statement case tostring
Change value from 1 To Yes In MySQL select statement

I'm only able to SELECT on a table. The table has a column called inty with a value of 0 or 1 …

mysql sql case
SQL CASE checking for two conditions from the same column

I currently have a CASE statement that checks to see whether certain tasks are completed or not, and then returns …

sql case multiple-conditions
PostgreSQL CASE usage in functions

Can't we use CASE condition outside SQL SELECT statements? E.g.: CASE WHEN old.applies_to = 'admin' THEN _applies_to = …

postgresql conditional case plpgsql
MySQL: Use CASE/ELSE value as join parameter

I'm trying to join the NAME and PHOTO from USERS table to the TRANSACTIONS table based on who is the …

php mysql join case finance
Dynamic order direction

I writing a SP that accepts as parameters column to sort and direction. I don't want to use dynamic SQL. …

sql sql-server stored-procedures sql-order-by case
How do I execute different SELECT statements based on a CASE

I am facing a problem in executing queries with CASE statement. Based on my condition,(for eg. length), I want …

sql sybase case
Mysql - Conditional Group By

I am trying to use CASE and GROUP BY together to conditionally filter results only if they match the CASE …

mysql group-by case having