2011-12-21 68 views
0

如何設置表A和B之間的關聯,如果表B中存在記錄,則不會顯示任何內容(如內連接反轉)。 這可以使用存在或不存在嗎? CakePHP的語法是什麼?Cakephp連接表語法

回答

0

你可以用not exists做到這一點:

select * from tableA a 
inner join tableB b on b.id not exists (select id from tableA where id <> b.id)