I have very little experience with database in general, but I’m willing to learn. I have created a small database that currently has less than 3500 records. I’m using the LibreBase with HSQLDB Embedded.
I have only one table and this table has 7 total columns, one of which is my Primary Key and one of which is relatively independent of the other 5. The 5 remaining columns are all integers and each record is distinct in the fact that no integer is repeated in any record. The integers can range from 1 to 75, with no negatives and the records do not contain any Null values.
I would like to be able to query the database and total the number of occurrences of each different integer. Grouping them in sequence and ordering them by the primary key.
I tried something like
SELECT FIRST_COL, SEC_COL, THIRD_COL, FOURTH_COL, FIFTH_COL, COUNT(*) AS total_instances, PRI_KEY
FROM "MY_TABLE"
GROUP BY FIRST_COL, SEC_COL, THIRD_COL, FOURTH_COL, FIFTH_COL
ORDER BY PRI_KEY
But this gives me an error about data could not be loaded, not in aggregate function.
If I get rid of the Primary key from the Select statement and order by the columns, I don’t get an error, but the results are obvious and not what I’m looking for.
Any and all help would be greatly appreciated.
Thank you in advance.