Search
 
SCRIPT & CODE EXAMPLE
 

SQL

oracle case

SELECT product_id, product_type_id,
  CASE product_type_id
    WHEN 1 THEN 'Book'
    WHEN 2 THEN 'Video'
    WHEN 3 THEN 'DVD'
    WHEN 4 THEN 'CD'
    ELSE 'Magazine'
  END
FROM products;
Comment

select case when oracle

SELECT
	CASE COLUMN1 WHEN 'N' THEN
		CASE COLUMN2
			WHEN 1 THEN NVL(COLUMN3,COLUMN4)
			WHEN 2 THEN NVL(COLUMN3,COLUMN4) 
			WHEN 3 THEN NVL(COLUMN3,COLUMN4) 
			WHEN 4 THEN NVL(COLUMN3,COLUMN4) 
			WHEN 5 THEN NVL(COLUMN3,COLUMN4) 
			WHEN 6 THEN NVL(COLUMN3,COLUMN4)
		ELSE COLUMN5 END 
	ELSE COLUMN6 END
FROM TABLE_NAME
Comment

PREVIOUS NEXT
Code Example
Sql :: greater than in mongodb query 
Sql :: how to run mysql on terminal mac 
Sql :: windows services sql 
Sql :: alter table add multiple columns postgresql 
Sql :: mysql isnull 
Sql :: show all event schedular on mysql 
Sql :: how to query without duplicate rows in sql 
Sql :: drop temp table if exists 
Sql :: update table from another table 
Sql :: laravel jwt 
Sql :: 1396(hy00) mysql error 
Sql :: mysql local password denied 
Sql :: postgresql combine values in one field 
Sql :: get foreign table names mysql 
Sql :: sqlite save db 
Sql :: How to add a Try/Catch to SQL Stored Procedure 
Sql :: mysql update two tables at once 
Sql :: mariadb json select 
Sql :: oracle sql concatenate results into string 
Sql :: sql create database 
Sql :: postgre alter table foreign key 
Sql :: sql right join with where clause 
Sql :: mysql delete database 
Sql :: mysqlclient error 
Sql :: get clob size oracle 
Sql :: SQL: get date difference in minutes 
Sql :: mysql select count 
Sql :: update foreign key value in mysql 
Sql :: mysql get date from datetime 
Sql :: sql find second highest salary employee 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =