PDO JOIN LEFT - 获取结果 - 无结果

时间:2016-01-21 13:32:43

标签: php pdo left-join

我在1个数据库中有2个表。结果应该包含表2中的所有值 NOT 。像这样的请求工作正常,但实际上很慢。我想改为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";

这就是我到目前为止 - 获得你的帮助会很棒!

$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();

有人可以帮我这个吗? PS。 link_id&amp;网址是网址。

0 个答案:

没有答案