Question : I have the following three tables in mysql database named “THE_COLLEGE” mysql> desc students; +———-+————-+——+—–+———+——-+ | Field | […]
Tag: case
Sql Statement to display multiple true statement
Question : I have a sql statement that checks for certain special characters in a string and returns that. SELECT […]
CASE statement multiple conditions
Question : I’ve got a simple table below, Select * from message_log where Message = ‘BUILD’ order by 1; +————+————-+ […]
Return multiple columns (int datatype) inside a CASE expression
Question : How can I get multiple columns from a CASE expression? with cte as ( select ROW_NUMBER() over (order […]
Use multiple OUTER JOINS in a CASE statement
Question : I tried to put : Select …. , (CASE WHEN (D.C_ZONE is null or D.C_ZONE = ”) THEN […]
Can CASE be used to select which table to JOIN?
Question : I’m attempting to use a CASE expression to select which table each row should be joined with. Say […]
Filtering previous month data with case statement
Question : These are my available attributes: DT_CURRENT_DT Month Year 11-OCT-18 10 2018 12-OCT-18 10 2018 13-OCT-18 10 2018 14-OCT-18 […]
Categorize rows as first, last or in between
Question : I have a table called road_events. create table road_events ( event_id number(5,0), road_id number(5,0), event_type nvarchar2(50), lifecycle_number number(5,0) […]
Oracle database – get two rows (A,B) for every (COD) row
Question : I have a Oracle database and a variable that can have a value for A and a value […]
Matching empty string is not working
Question : I have the following query SELECT Ice.IceId, Ice.Code, Box.Ice, LEN(Box.Ice) AS IceCharLength, DATALENGTH(Box.Ice) AS DataLength, Box.Ice, ASCII(Box.Ice) AS […]