nirosha rathnayaka
nirosha rathnayaka

Reputation: 198

Search for negative numbers in mysql

I want to get the count of the negative numbers saved in a mysql table. Ex: I want to get total numbers of withdrawals and value from the account within last month.

I know that this can be done using extra row. But I want to do this without changing the table structure. I tried with "WHERE Amount < 0" but didn't work. Any help please.

Upvotes: 2

Views: 8035

Answers (2)

Anshu
Anshu

Reputation: 7853

This works for me

select count(0) from test where id < 0

Upvotes: 1

Martin Wilson
Martin Wilson

Reputation: 3386

Something like:

SELECT COUNT(*) FROM Account WHERE Amount<0;

Upvotes: 1

Related Questions