Skip to content
Advertisement

count on multiple boolean columns

My Current Table looks as follows

basically the transaction table tracks the specific feature that triggered the transaction. I need to grab the count for each feature for a specific id, something like this:

I’ve been getting the count doing 3 individual counts

but the seems really inefficient.

Advertisement

Answer

Do you just want conditional aggregation? Postgres makes this easy by supporting the filter clause:

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