SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Non-Member
    Join Date
    Oct 2008
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    WHERE clause and INNER JOIN

    Hey,

    I have this query:

    Code MySQL:
    SELECT friends.userid1, friends.userid2, customers.id, customers.profile_small_pic 
    FROM friends 
    WHERE friends.userid1 = 70 
    INNER JOIN customers 
    ON friends.userid2 = customers.id

    if I remove the WHERE clause it works fine. Is there a way to define which userid1 I want? I don't want all of the data..

    This is the error
    Code:
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN customers  ON friends . userid2 = customers . id
    LIMIT 0, 30' at line 1

  2. #2
    Team ********* Louis Simoneau's Avatar
    Join Date
    Sep 2009
    Location
    Melbourne, Australia
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The WHERE clause goes after the JOIN, not before


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
  •