View Full Version : Select all rows where the dec row contains or ends with 0.

02-01-2007, 06:22 PM
I need to select all rows * from a MySQL database where the dec column ends with 0 (or contains 0 if it is easier). How can I do that?

Best Regards

02-01-2007, 07:09 PM
ok this one is fairly simple you would do something like this

SELECT * FROM table WHERE `dec` LIKE '%0'

If you wanted to check that the field had a 0 in there no matter where it is then you can do

SELECT * FROM table WHERE `dec` LIKE '%0%'

The %'s act as wildcards so doing %0 means that the last character must be 0 and doing %0% means that the cheracter 0 can be anywhere in that field.

If you need any further information let me know