I have this table
tracking
- id
- referer
- status
- session
i want to COUNT rows for the two tables (joined with itself)
SELECT COUNT(t1.id), COUNT(t2.id)
FROM tracking t1
INNER JOIN tracking t2 on t2.session = t1.session AND t2.status = 2
WHERE t1.referer = 'http://google.com' AND t1.status = 1
with this data :
id | referer | status | session
1 | http://google.com | 1 | ABC
2 | ################# | 2 | ABC
i need to get (1,1) but im getting (1,null)
i tried with RIGHT JOIN but is not working either.
LEFT OUTER JOIN..INNER JOINcan't possibly return different counts since you're filtering out any possibleNULLs, so every row is getting counted for both fields.