Skip to content
Advertisement

How to filter PostgresSQL query result dependent on value on some column?

I have this query:

Which results in this:

enter image description here

Instead of returning all the 4 rows, I’d like to return the column which has a value “1”. How can I achieve this?

Advertisement

Answer

If you just want it to show the column with value = 1, you already have the answer. With mi answer you select all the columns with values different to 0.

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