I think it's either this:
SQL code:
SELECT bid, COUNT(*) AS lid_count
FROM TABLE
WHERE lid IN (2,8)
GROUP BY bid
HAVING lid_count > 1
Or this:
SQL code:
SELECT bid
FROM TABLE
WHERE lid IN (2,8)
GROUP BY bid
HAVING COUNT(*) > 1
Or something along those the lines.
The key bit is the HAVING - it's like a WHERE for GROUP BYs.
|