Skip to content
Advertisement

How to sum the columns counts of the same table?

I have a table with 4 columns, I need to SUM the COUNT of each one.

I am using PostgreSQL.

Advertisement

Answer

SELECT COUNT(Col1) + Count(Col2) + Count(Col3) + Count(Col4) as Total FROM *Table*

Adds the Counts of all 4 columns together. That should do the trick for you.

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