View Full Version : [SQL] Select from 3 identical tables?
I rarely create complex sqls and ain't done a join for years.
I can get two tables to join, but not 3.
+rep to any help :)
LMS16
10-09-2010, 06:18 PM
Can you expand on what you want?
Wouldnt you use the distinct? Havent used it personally but I think you need to use that :)
Lew.
So far I have:
SELECT comments.id FROM comments c INNER JOIN group_comments g ON c.id = g.id JOIN photo_comments p ON g.id = p.id
But that ain't working
LMS16
10-09-2010, 08:58 PM
I prefer to stick to simple sql commands if poss lol. But I think it wud be work checking out the distinct command?
Lew.
So far I have:
SELECT comments.id FROM comments c INNER JOIN group_comments g ON c.id = g.id JOIN photo_comments p ON g.id = p.id
But that ain't working
Try this
SELECT * FROM ( comments LEFT JOIN group_comments ON comments.id = group_comments.id ) LEFT JOIN photo_comments ON group_comments.id = photo_comments.id
Try this
SELECT * FROM ( comments LEFT JOIN group_comments ON comments.id = group_comments.id ) LEFT JOIN photo_comments ON group_comments.id = photo_comments.id
Tried that too =[
In the end i just used UNION :)
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.