Skip to content
Advertisement

SQL GROUP BY IN CASE STATEMENT

i have one table

enter image description here

i would like to classify the apple as below

enter image description here

i try to add code as below, but its not like what I expected

I try this code also, but got error

Advertisement

Answer

You want conditional aggregation here, which involves summing over the CASE expression:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement