2011-12-21 70 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)