Results 1 to 6 of 6
  1. #1
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default [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

  2. #2
    Join Date
    Sep 2009
    Location
    Hull
    Posts
    827
    Tokens
    0

    Latest Awards:

    Default

    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.
    Im not here to be loved, I love to be hated :-}


  3. #3
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    So far I have:

    Code:
     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

  4. #4
    Join Date
    Sep 2009
    Location
    Hull
    Posts
    827
    Tokens
    0

    Latest Awards:

    Default

    I prefer to stick to simple sql commands if poss lol. But I think it wud be work checking out the distinct command?

    Lew.
    Im not here to be loved, I love to be hated :-}


  5. #5
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    Quote Originally Posted by Moh View Post
    So far I have:

    Code:
     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

    Code:
    SELECT * FROM ( comments LEFT JOIN group_comments ON comments.id = group_comments.id ) LEFT JOIN photo_comments ON group_comments.id = photo_comments.id

  6. #6
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    Quote Originally Posted by Blob View Post
    Try this

    Code:
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •