Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
10-18-2002, 02:55 PM #1
- Join Date
- Jul 2002
- Cape Town, S Africa
- Thanked 0 Times in 0 Posts
mySQL JOIN statement, please help.
I want to accomplish this with a single statement, but I don't know much about joins...
SELECT COUNT(*) AS val1 FROM topics WHERE fid = 2
SELECT COUNT(*) AS val2 FROM posts WHERE fid = 2
Return value is val1 + val2
SELECT COUNT(*) FROM topics LEFT JOIN posts ON topics.fid = posts.fid WHERE topics.FID = 2
...but it returned 6 instead of 5