我加入Sites
與History
並選擇不在History
中的行。將WHERE子句添加到Left Join上的一個表中?
$data = mysql_query("
select * from Sites
left join History
on Sites.URL = History.URL
where History.URL is null
order by Karma
");
的問題是,我想補充WHERE UID = $uid
錶的歷史,所以我只參加行與所述UID。
我想要做這樣的事情:
select * from Sites
left join History where UID = $uid
on Sites.URL = History.URL
where History.URL is null
order by Karma
這可能嗎?我怎樣才能做到這一點?