Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnevitt
Creator
Creator

Sql help

Hi,

I have the following sql load statement and I am receiving an error.  I'm sure it's something simple and would really appreciate any advice.

The statement works if I comment out from 'case' to 'end'.

Thanks,

Daniel

select ph.create_dt,ph.hdr_num,ph.pay_dt_calendar_cd,ph.pay_dt_days1,ph.pay_dt_days2,ph.pay_dt_days_type_ind,ph.pay_dt_event1_ind,ph.pay_dt_event2_ind
from tempest_tier1.v_BO_PHYSICAL_HDR ph
where create_dt > '2015/10/10'
case
when ph.pay_dt_days_type_ind = "B"
then "Business Days"
end

12 Replies
danielnevitt
Creator
Creator
Author

Hi Clever Anjos

At the moment ph.pay_dt_days_type_ind returns B or C.

I would like it to return Business Days (instead of B) and Calendar Days (instead of C).

I hope the above makes sense.

Balraj - unfortunately that code returns an error as well.

Clever_Anjos
Employee
Employee

select ph.create_dt

  ,ph.hdr_num

  ,ph.pay_dt_calendar_cd

  ,ph.pay_dt_days1

  ,ph.pay_dt_days2

  ,case when ph.pay_dt_days_type_ind = "B" then "Business Days" end as ph.pay_dt_days_type_ind

  ,ph.pay_dt_event1_ind

  ,ph.pay_dt_event2_ind

from tempest_tier1.v_BO_PHYSICAL_HDR ph

where create_dt > '2015/10/10'

Peter_Cammaert
Partner - Champion III
Partner - Champion III

...and add this between case and end (for example before the first 'when')

     when ph.pay_dt_days_type_ind = 'C' then 'Calendar Days'


As Clever already indicated, use single quotes to specify string values in SQL.


Best,


Peter