cancel
Showing results for 
Search instead for 
Did you mean: 

Case statement related issue

Former Member
0 Kudos

Dear All,

select gjahr,wtg001, wtg002, XYZ,

  case

  when wtg001 != 0  then concat(gjahr, '001')

  wtg001 as XYZ   <------------------------   Here i want value of wtg001 in XYZ

  

  else

  case 

  when wtg002 = 0 then concat(gjahr, '002') end  end as gjahr

  from cosp;

-Regards,

Amol

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor
0 Kudos

What is the question here?

Also: the AS <column alias> clause can only be used once per column projection definition and it mus be at the end of it.

- Lars

Former Member
0 Kudos

Thanks for your response.

Then how can i capture the value inside case to other column.

-Amol

lbreddemann
Active Contributor
0 Kudos

If you want to split the data from an input column to multiple output columns you will have to have a separate case statement for each target column.

That's standard SQL, not SAP HANA specific.

- Lars

Former Member
0 Kudos

Thanks Lars,

Let me try...

Answers (0)