Skip to content
Advertisement

count rows with group by and having count (postgres)

Hi I’m having trouble with query in PostgreSQL . Here is example data from my table imgs_tags :

I had tried :

and it returns as below :

But I want it to return count = 3 . How can i fix it ? Thanks

Advertisement

Answer

You should write like this:

or if you want to do some further operation with this data then better use Common Table Expression (with clause) like below:

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