1
我到目前为止以下查询:Doctrine2 DQL问题与COUNT = 0
$shopQuery = $qb->select('DISTINCT u')
->from("BlahUserBundle:User", 'u')
->innerJoin('u.followers', 'followers')
->andWhere('followers.id != :userId')
->setParameter('userId', $user->getId())
->orWhere('') //or where those user who doesn't have a follower yet
//->setMaxResults(5)
;
我试图找到一种方式来查询谁没有跟随的所有用户和其追随者是不是我的自我(在这种情况下,我的自我是$user->getId()
)。我该怎么做?
。我认为你需要一个子查询。让我想一想:) –
@Pi Wi是对的,但是你可以用左连接代替你的内连接来匹配两个结果。 –