CASE Statement use in Select Statement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2022 12:19 AM
Dear All,
Can we Use CASE Statement in SQL Query while "Creating View" with "SQL Query"...i.e...
SELECT v.FianaceYear, v.FinanceMonth ,FT.FinanceType_Eng, M.Description_en
,CASE WHEN v.tContractStatusId =3 and v.IsWriteOff IS NULL THEN 'Termianted'
WHEN v.tContractStatusId =3 and v.IsWriteOff=1 THEN 'Write Off - Termianted'
WHEN v.IsExpired =1 and v.IsWriteOff IS NULL THEN 'Expired'
WHEN v.IsExpired =1 and v.IsWriteOff=1 THEN 'Write Off - Expired'
WHEN v.tContractStatusId=1 and v.IsExpired =0 and v.IsWriteOff=1 THEN 'Write Off - Current'
ELSE 'Current' END ContractStatus
........
if we can use CASE in select statement...please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2022 09:16 AM
Yes - I just tested using this;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2022 09:19 AM
Also w/ Postgres SQL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2022 09:22 AM
But really, if you want to use SQL to build an Incorta view use the derived table => Incorta SQL option. It's speedy.
