Skip to content
Advertisement

One select instead two selects with where

I have two similar select like this:

I would like to simplify to one query, is it possible to write one select instead of this two?

Advertisement

Answer

Yes. One method is two columns using conditional aggregation:

Another is separate rows:

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