Skip to content
Advertisement

count the 3 different values ​that a column can take

I’m trying to count the 3 different values ​​that a column in a table can take, in a single SELECT. What am I doing wrong?

I am using a postgresql table where the column named “tipoprova” is an integer

Advertisement

Answer

You are looking for filtered aggregation:


Your query is wrong, because you have the wrong syntax for the CASE expression. It needs to be THEN not THAN and it also needs to be ended with END, e.g.:

would be the correct syntax

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