Skip to main content
Solved

Lobby Data Source using Case statement


Peter.Buitenhuis
Sidekick (Former Employee)
Forum|alt.badge.img+8

I have following SQL statement which gives me the right result:

 

SELECT CASE WHEN PART_NO LIKE '1%' THEN 'A' WHEN PART_NO LIKE '2%' THEN 'B' WHEN PART_NO LIKE '3%' THEN 'C' END PART_TYPE, 

MAX(PART_NO) PART_NO FROM PART_CATALOG WHERE (PART_NO LIKE '1%' OR PART_NO LIKE '2%' OR PART_NO LIKE '3%')

GROUP BY CASE WHEN PART_NO LIKE '1%' THEN 'A' WHEN PART_NO LIKE '2%' THEN 'B' WHEN PART_NO LIKE '3%' THEN 'C' END

 

How would this convert to definition of a Lobby Data Source (with view Part_Catalog) regarding Condition and Group By?

Best answer by anmise

PEBUNL wrote:

I have following SQL statement which gives me the right result:

 

SELECT CASE WHEN PART_NO LIKE '1%' THEN 'A' WHEN PART_NO LIKE '2%' THEN 'B' WHEN PART_NO LIKE '3%' THEN 'C' END PART_TYPE, 

MAX(PART_NO) PART_NO FROM PART_CATALOG WHERE (PART_NO LIKE '1%' OR PART_NO LIKE '2%' OR PART_NO LIKE '3%')

GROUP BY CASE WHEN PART_NO LIKE '1%' THEN 'A' WHEN PART_NO LIKE '2%' THEN 'B' WHEN PART_NO LIKE '3%' THEN 'C' END

 

How would this convert to definition of a Lobby Data Source (with view Part_Catalog) regarding Condition and Group By?

View: PART_CATALOG

Condition: Your where clause

Columns: CASE WHEN PART_NO LIKE '1%' THEN 'A' WHEN PART_NO LIKE '2%' THEN 'B' WHEN PART_NO LIKE '3%' THEN 'C' END and MAX(PART_NO)

Group by: CASE WHEN PART_NO LIKE '1%' THEN 'A' WHEN PART_NO LIKE '2%' THEN 'B' WHEN PART_NO LIKE '3%' THEN 'C' END

 

 

View original
Did this topic help you find an answer to your question?

2 replies

  • Superhero (Employee)
  • 1470 replies
  • Answer
  • May 3, 2020
PEBUNL wrote:

I have following SQL statement which gives me the right result:

 

SELECT CASE WHEN PART_NO LIKE '1%' THEN 'A' WHEN PART_NO LIKE '2%' THEN 'B' WHEN PART_NO LIKE '3%' THEN 'C' END PART_TYPE, 

MAX(PART_NO) PART_NO FROM PART_CATALOG WHERE (PART_NO LIKE '1%' OR PART_NO LIKE '2%' OR PART_NO LIKE '3%')

GROUP BY CASE WHEN PART_NO LIKE '1%' THEN 'A' WHEN PART_NO LIKE '2%' THEN 'B' WHEN PART_NO LIKE '3%' THEN 'C' END

 

How would this convert to definition of a Lobby Data Source (with view Part_Catalog) regarding Condition and Group By?

View: PART_CATALOG

Condition: Your where clause

Columns: CASE WHEN PART_NO LIKE '1%' THEN 'A' WHEN PART_NO LIKE '2%' THEN 'B' WHEN PART_NO LIKE '3%' THEN 'C' END and MAX(PART_NO)

Group by: CASE WHEN PART_NO LIKE '1%' THEN 'A' WHEN PART_NO LIKE '2%' THEN 'B' WHEN PART_NO LIKE '3%' THEN 'C' END

 

 


Peter.Buitenhuis
Sidekick (Former Employee)
Forum|alt.badge.img+8
  • Author
  • Sidekick (Former Employee)
  • 30 replies
  • May 4, 2020

Ah, so repeat the Case statement in the Column definition. It works! Thanks alot :grinning:


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings