SELECT *, COUNT(*) in SQLite SELECT *, COUNT(*) in SQLite sql sql

SELECT *, COUNT(*) in SQLite


SELECT *, COUNT(*) FROM my_table is not what you want, and it's not really valid SQL, you have to group by all the columns that's not an aggregate.

You'd want something like

SELECT somecolumn,someothercolumn, COUNT(*)    FROM my_table GROUP BY somecolumn,someothercolumn


If you want to count the number of records in your table, simply run:

    SELECT COUNT(*) FROM your_table;


count(*) is an aggregate function. Aggregate functions need to be grouped for a meaningful results. You can read: count columns group by