我想知道是否有办法只加入那些在我的查询中将列滑块设置为0的行。现在它看起来像
$db->queryCache('SELECT ' . $objectFields . ' FROM people o
LEFT JOIN zdjecia z ON z.obiekt=o.id
LEFT JOIN obkat ON obkat.obiekt=o.id
WHERE o.ac=1
GROUP BY o.id
ORDER BY priorytet DESC', array(
'people',
'obkat',
'zdjecia'
), 3600);
我希望只加入zdjecia
列canUse
设置为1
我试过了:
$db->queryCache('SELECT ' . $objectFields . ' FROM people o
LEFT JOIN zdjecia z ON z.obiekt=o.id
LEFT JOIN obkat ON obkat.obiekt=o.id
WHERE o.ac=1 AND z.canUse=1
GROUP BY o.id
ORDER BY priorytet DESC', array(
'people',
'obkat',
'zdjecia'
), 3600);
但这没有帮助。在这样的查询中,只从表中连接某些行的正确方法是什么?
谢谢!