SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Multiple joins

  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple joins

    I am trying to do a multiple join, but keep getting errors. Is this even possible:

    Code:
    select REFERRER.URL, REFERRER.TAG_ID
    from REFERRER
    join TAGS on (TAGS.TAGS_ID = REFERRER.TAG_ID)
    join SITE on (SITE.SITE_ID = TAGS.TAG_ID)
    where SITE.ACCOUNT_ID = "$var"
    I essentially have the following tables:

    SITE with columns ACCOUNT_ID, SITE_ID
    TAGS with columns TAG_ID, SITE_ID
    REFERRER with columns URL, TAG_ID

    I am basically trying to use ACCOUNT_ID to pull URL and TAG_ID from the referrer column in one query. Should be simple but I cannot get me head arounf it.

    Ta

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Dada_Dan View Post
    but keep getting errors.
    What errors?

    There is an error in your query:

    join SITE on (SITE.SITE_ID = TAGS.TAG_ID)

    should be:

    join SITE on (SITE.SITE_ID = TAGS.SITE_ID)

    Right?

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you! I cannot begin to tell you how long I have been starting at that.

    Turns out that was one of two typos, the other being TAGS_ID should have been TAG_ID.

    Thanks


Bookmarks

Posting Permissions

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