MYSQL selects where the field does not contain a specific string character

I use sql to select all the URLs of my sites from a table.

$sql = 'select * from pages where "myURL field";

However, I want to be more specific with my request. For example, in my table there are several duplicate links:

about-us
./about-us

I do not want the field to ./about usbe selected. Is there any way to say:

select * where "myURL field" does not begin with . /

Or should I just forget it and parse it with PHP?

+4
source share
3 answers
SELECT * FROM pages WHERE some_col NOT LIKE './%';

This will extract all rows where some_col does not start with ./

+9
source

Use LIKEin mysql to verify that it does not start with ./. Use the code below

SELECT * FROM pages WHERE col_name NOT LIKE './%';

,

+1
select * from pages where my_url NOT LIKE './%';
0

All Articles