July 27, 2015

Case statement in Where clause

where x = 1
and
(
case when y in ('O', 'P', 'H') then 'A'
else 'I'
end
) = 'I'
and z = 4

July 16, 2015

Coalesce

SELECT COALESCE(currency,'Dollar') as display_currency

June 25, 2015

Teradata tableless union example

select '123' as emp_no from (select '0' as dummy) as x
union
select '456' as emp_no from (select '0' as dummy) as x