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是對的,但是你可以用左連接代替你的內連接來匹配兩個結果。 –