Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL: Check if first character is _not_ A-Z

Tags:

mysql

I have to create an SQL Query to get all rows starting with a specific character, except if the parameter passed to the (PHP) function is 0, in that case it should get every row that does not start with A - Z (like #0-9.,$ etc).

What is the easiest and fastest way to get those rows?

DB: MySQL 5.1
Column: title

like image 688
Morfildur Avatar asked Mar 19 '10 13:03

Morfildur


1 Answers

SELECT  *
FROM    mytable
WHERE   title NOT RLIKE '^[A-Z]'
like image 59
Quassnoi Avatar answered Oct 08 '22 12:10

Quassnoi