Hey ! I'm looking for sql 'like' command help....
I had mysql database and it had settlement table. On that table there is column named 'settlement'.
In the settlement column there are so many amounts.....
Now I want to find recors '0 values'
Can anybody help me ?

Recommended Answers

All 4 Replies

The column is a string type and the value is literally something like 0 values or is an integer, float column?

Can you show the table schema and an example of data?

Based on what you've said the command would be something like

SELECT * FROM settlement WHERE settlement = 0

I have found it is a good idea to cover the records where the field is blank, 0 or null with something like:

SELECT * FROM settlement WHERE settlement < 0.01 or settlement IS NULL

I realize this will get records where the settlement is not zero but sometimes you need to know about these. I inherited a database that had values like 0.00033 stored for the balance and I queried for value = 0 and was missing records.

I think NULLIF(settlement, 0) IS NULL is better than settlement < 0.01 or settlement IS NULL
Try this:

SELECT * FROM settlement WHERE NULLIF(settlement, 0) IS NULL
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.