Select Query | Select Entires That Don't Start With A Number - MySQL

Try this:

SELECT DISTINCT name, location FROM object
       WHERE substring(location, 1, 1)
                  NOT IN ('1','2','3','4','5','6','7','8','9');

or you have to add NOT LIKE before every number:

SELECT DISTINCT name, location FROM object
       WHERE location NOT LIKE '1%'
          OR location NOT LIKE '2%'
          ...

You can use the following stntax:

SELECT column FROM TABLE where  column NOT REGEXP '^[0-9]+$' ;


SELECT DISTINCT name, location FROM object
                WHERE location NOT REGEXP '^[0-9]+$' ;

Try this, its simpler:-

SELECT DISTINCT name, location FROM object WHERE location NOT LIKE '[0-9]%';

Tags:

Mysql

Sql

Select