Skip to content
Advertisement

How to sum COUNT values

I’m very new to SQLite so please forgive me asking something stupid. From a database with a table containing aircraft data I can count the records with data from a manufacturer with my existing query:

This gives me

Is there a way to get the calculated grand total (3504) in the results without removing the ‘GROUP BY’clause? I can’t get SUM() and TOTAL() to work. The questions about this counting an aggregating seem to use values found in the tables.

Advertisement

Answer

With UNION ALL:

See the demo.
Or with a CTE:

See the demo.

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