Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql case when on date

SELECT
  id,
  CASE
    WHEN date_activated > '2011-11-23 18:30:00' THEN 'after'
    WHEN date_activated > '2010-01-20 00:00:00' THEN 'before'
    ELSE 'not yet'
  END AS date_note
FROM table1;
Comment

mysql case when or

SELECT
    CASE 
        WHEN
            column IS NULL OR another_column = 1
        THEN
            'yes' 
        ELSE
            'no' 
    END AS 'MyData'
FROM
    table_name;
Comment

mysql case when in select

SELECT CASE col1
	WHEN 'agree' THEN 'Ok'
	WHEN 'disagree' THEN 'Ko'
    ELSE
        CASE 
            WHEN col2 >= 1 THEN 'Ko'
            ELSE 'Maybe'
        END
END AS my_result
FROM table_name;
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql where value is null 
Sql :: how to use rank function in sql 
Sql :: sql manhattan distance 
Sql :: sql server list locks 
Sql :: SQL Modify Column in a Table -MySQL 
Sql :: mysql update with subquery 
Sql :: how to check the mysql version mac 
Sql :: How to convert DateTime to VarChar SQL 
Sql :: phpmyadmin password root 
Sql :: sql function 
Sql :: t sql null or empty string 
Sql :: mysql command not working in linux 
Sql :: remove user and their privileges postgres 
Sql :: sql query to get the number of rows in a table 
Sql :: sql percentage with % rounded down 
Sql :: sql foreign key 
Sql :: import mysql dump command line 
Sql :: xampp import sql file command line 
Sql :: left join in codeigniter query builder 
Sql :: alter table name sql 
Sql :: myswql show full processlist 
Sql :: mysql find duplicates in same table 
Sql :: sql groub by count 
Sql :: primary key multiple 
Sql :: mysql decimal allow negative values? 
Sql :: Postgres - Login and connect as default user 
Sql :: MySQL INSERT IGNORE Statement 
Sql :: PostgreSQL types and C# types 
Sql :: remove auto increment mysql 
Sql :: sql number columns 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =