How do I remove data from a request?

this is my sample request

$sql = mysql_query("SELECT * FROM dataweb WHERE web LIKE 'google%'ORDER BY ASC LIMIT 8"); 

the above query is looking for similar domains. but I want to delete all aka Google results ... which means the result returns google.com, google.br, google.de, etc.

I only need repositories that start with google ..

+3
source share
2 answers

To do this, do it. DO NOT LIKE.

+7
source

Do you need domains starting with googlebut not google.? You can use REGEXPfor this.

SELECT web
FROM   (SELECT 'google.com' AS web UNION ALL
        SELECT 'google.co.uk' UNION ALL
        SELECT 'google.br' UNION ALL
        SELECT 'google.de' UNION ALL
        SELECT 'googleplex.com' UNION ALL
        SELECT 'google-watch.org' UNION ALL
        SELECT 'ooglegoogle.com') dataweb
WHERE  web REGEXP '^google[^.].'
ORDER  BY web ASC
LIMIT  8  

Returns

web
----------------
google-watch.org
googleplex.com
+3
source

Source: https://habr.com/ru/post/1791631/


All Articles