...

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



oskare100
02-01-2007, 05:22 PM
Hello,
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

neomaximus2k
02-01-2007, 06: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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum