0
当使用以下查询时,仅返回24条记录,因为两个客户有多个符合条件的宠物,但Doctrine不会返回我的Zend App中的其他记录。原则1.2.3不选择所有记录
$q = Doctrine_Query::create()
->select('c.clientID,c.firstname,c.lastname,c.address1,c.address2,c.address3,t.county,p.name')
->from('PetManager_Model_Clients c')
->leftJoin('c.PetManager_Model_Pets p')
->leftJoin('c.PetManager_Model_Counties t')
->leftJoin('c.PetManager_Model_Groomappointments g')
->where('p.type=2 AND g.gapmtClient IS NULL');
下面的MySQL查询返回26条记录,任何人都可以告诉我如何复制它在教义
mysql> Select DISTINCT c.clientid,c.firstname,c.lastname,p.name
-> from (clients AS c left join pets as p on c.clientid =p.owner) left join groomappointments AS g on g.gapmtclient=c.clientid
-> where p.type=2 AND g.gapmtclient is null;
感谢清理这件事 – Graham 2011-06-05 18:11:14