Count all numbers in a column (MySQL Query)

I’m sort of a noob when it comes to MySQL, I was wondering how to count all the numbers in a column. I have tried numerous ways with the COUNT(*) and COUNT function queries, but have had no success. For example, I have the column titled ‘Money’

I want to count all the numbers in that column, how would I achieve this? (i.e the total of all the money in the database)

SELECT SUM( column )

You’re awesome.

Now is there anyway I can exclude certain values from that, or am I just going to have to make separate queries to query for those and subtract?

SELECT SUM( column ) FROM table WHERE TimePlayed > 5000;

Thank you. Now I’ve run into the problem, when I call getData() (mysqloo), it returns the table as so.

I can’t call print(table[1].sum(money)) since it says “Attempted to index sum, a nil value”.

Is there any workaround?

print( table[1][“sum(money)”] );

I love you.

Thank you soooooooooooooooooooooooo much.

You could also do SELECT SUM( money ) AS ‘money’ and then do table[ 1 ].money