0

I’m working in Eloqua BI. I am trying to create one column in which I’d like to include data from couple of other columns. Those other columns contain numbers of customers. Those columns have been created so far with a following SQL logic (in Edit Column Formula Field):

CASE 
  WHEN column_name = '1' THEN 'a' 
  WHEN column_name = '2' THEN 'b'
  WHEN column_name = '3' THEN 'c'
ELSE ‘def’

What I’ve find out is the code above returns correct value for only the first WHEN. All other columns have random values.

How could I fix the code above to receive correct values for all columns? Why that statement is incorrect?

APC
  • 144,005
  • 19
  • 170
  • 281
Marcel
  • 428
  • 4
  • 8
  • 2
    A `case` expression only returns one value. Please provide sample data and desired results to clarify what you want to do. – Gordon Linoff Feb 04 '19 at 19:22
  • I don't think CASE is what you are looking for. From what you are asking you might look at a UNION. https://www.w3schools.com/sql/sql_union.asp – Dillon_Su Feb 04 '19 at 19:29
  • In addition to Gordon's comment (`case` returns a single value), note that you can nest `case` clauses, and the nested clauses could reference different columns. But until we see the existing data and table structure, and expected results, we cannot determines exactly what you need. – Mark Stewart Feb 04 '19 at 19:44

0 Answers0