2

I have 2 tables in 1 database. The result shall have all values, which are NOT in table 2. The request like this works fine, but is really slow. I would like to change to LEFT JOIN

$abfrage = "SELECT * FROM spotify WHERE 
pos1 > '0' AND pos1 <= '100' 
AND (land = 'GLOBAL' OR land = 'DE') 
AND link_id NOT IN (SELECT URL FROM spotify_blacklist) ORDER BY song ASC";

This is what i have so far - it would be great to get your help!

$abfrage = "SELECT * FROM spotify 
WHERE pos1 > '0' AND pos1 <= '100' 
AND (land = 'GLOBAL' OR land = 'DE') LEFT JOIN spotify_blacklist  
ON (spotify.link_id != spotify_blacklist.URL) 
WHERE spotify_blacklist.URL IS NULL";
$stmt = $pdo->prepare($abfrage);
$stmt->execute();

Can someone help me on this? PS. link_id & URL are URL´s.

LJSven
  • 147
  • 3
  • 13

0 Answers0