Page 1 of 1

Need help

Posted: Sat May 31, 2008 9:20 am
by shakeel
Hello

I want to get all rows from a table where "Title" column beginning with any number. What should I use in Like operator. I am using MySql.

thanks.

Re: Need help

Posted: Sun Jun 01, 2008 4:31 am
by vargadanis
Hi!

I know a simple way to do it but it is very unsophisticated:

Code: Select all

SELECT * FROM `table` WHERE nev LIKE '0%' OR '1%' OR '2%' OR '3%' OR '4%' OR '5%' OR '6%' OR '7%' OR '8%' OR '9%'

Re: Need help

Posted: Sun Jun 01, 2008 4:57 am
by onion2k
You can use regular expressions in SQL...

Code: Select all

SELECT *
FROM `table`
WHERE 1
AND `title` REGEXP '^[[:digit:]].*'

Re: Need help

Posted: Sun Jun 01, 2008 6:08 am
by vargadanis
Here we go.. I told u mine was a simple solution..

Re: Need help

Posted: Sun Jun 01, 2008 4:08 pm
by califdon
shakeel, in the future, please do not use vague, general Subjects like "Need help." Those of us who spend a lot of time in this forum do not usually even read such posts. If the questioner doesn't have enough interest to give us an indication of what kind of help is requested, we just skip them.

Re: Need help

Posted: Mon Jun 02, 2008 9:02 am
by shakeel
Thanks to all

Re: Need help

Posted: Tue Jun 03, 2008 1:44 pm
by vargadanis
Next time, please, put some info in the subject of the topic so that more peeps might pay attention. :P