Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql if else

SELECT OrderID, Quantity, 
CASE WHEN Quantity > 10 THEN "MORE" ELSE "LESS" END as x
FROM OrderDetails;

SELECT OrderID, Quantity, 
IF (Quantity > 10, "MORE", "LESS") as x
FROM OrderDetails;
Comment

mysql else if

IF condition1 THEN
    statements;
ELSEIF condition2 THEN # OPTIONAL
	statements;
ELSE # OPTIONAL
    statements;
END IF;
Comment

mysql if

SELECT user_display_image AS user_image,
       user_display_name AS user_name,
       invitee_phone,
       (CASE WHEN invitee_status = 1 THEN "attending"
             WHEN invitee_status = 2 THEN "unsure"
             WHEN invitee_status = 3 THEN "declined"
             WHEN invitee_status = 0 THEN "notreviwed"
       END) AS invitee_status
  FROM your_table
Comment

if mysql

SELECT IF(500<1000, "YES", "NO");
Comment

mysql if statement

-- PL/SQL
BEGIN
    IF my_val = 1 THEN [...]
    ELSE [...]
    END IF;
END;
-- In a query
SELECT CASE WHEN my_col = 1 THEN 'Ok' ELSE 'Ko' END AS my_result;
Comment

mysql if else

IF condition THEN
   statements;
ELSE
   else-statements;
END IF;
Comment

mysql if statement in where clause

SELECT  `id` ,  `naam` 
FROM  `klanten` 
WHERE IF(`email` != '', `email`, `email2`) LIKE  '%@domain.nl%'
Comment

MySQL if condition

The if accept one condition, if this condition is true then the true_value will occur 
else the false_value will occur.
IF(condition, true_value, false_value)
Tips : can be to update some data
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle apex debug time 
Sql :: sql create database 
Sql :: mysql collation for all languages 
Sql :: sql select case when 
Sql :: sql server insert inner join 
Sql :: sql server add time to date 
Sql :: failed to connect to mysql at localhost:3306 with user root 
Sql :: with postgres 
Sql :: mysql declare variable 
Sql :: where with multiple conditions in mongodb 
Sql :: mysql delete database 
Sql :: sql select rows with different values in one column 
Sql :: create date sql 
Sql :: mysql remove records 
Sql :: postgresql filter on 
Sql :: add comma after 3 digits select sql 
Sql :: role "postgres" does not exist 
Sql :: Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘a’. 
Sql :: oracle object dependencies 
Sql :: sql stored procedure update if parameter is not null 
Sql :: open postgresql.conf 
Sql :: sql find second highest salary employee 
Sql :: sql left 
Sql :: mariadb cast to int 
Sql :: insert array into mysql column 
Sql :: postgres data location 
Sql :: oracle parameter 
Sql :: How to import CSV file into a MySQL table 
Sql :: SQL Rename Column in a Table 
Sql :: using SQL in rails migration 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =