SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2004
    Location
    Utah, USA
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wrestling with a syntax error

    Hi all,

    I'm wrestling a bit with a syntax error that I'm unable to figure out and am wondering if someone on this forum might be able to help me see the light.

    Here's the query and the resulting error:
    Code MySQL:
    mysql> SELECT u.name AS 'connect username', field_firstName.value AS 'first name', field_lastName.value AS 'last name', field_title.value AS 'job title', u.mail AS 'email address', field_shipping_address.value AS 'address', DATE_FORMAT(FROM_UNIXTIME(u.access),'%b-%d-%Y') AS 'last visit', n.title AS 'group'
        ->   FROM users u
        ->   LEFT JOIN profile_values as field_firstName ON u.uid = field_firstName.uid AND field_firstName.field_name = 'profile_firstName'
        ->   LEFT JOIN profile_values as field_lastName ON u.uid = field_lastName.uid AND field_lastName.field_name = 'profile_lastName'
        ->   LEFT JOIN profile_values as field_title ON u.uid = field_title.uid AND field_title.field_name = 'title'
        ->   LEFT JOIN profile_values as field_shipping_address ON u.uid = field_shipping_address.uid AND field_shipping_address.field_name = 'profile_shipping_address'
        ->   LEFT JOIN profile_values pv
        -> LEFT OUTER JOIN og_uid og
        ->   ON u.uid = og.uid
        -> LEFT OUTER JOIN node n
        ->   ON og.nid = n.nid
        -> WHERE n.nid = 3163
        -> ORDER BY n.title ASC, u.access DESC;
    ERROR 1064 (42000): 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 'WHERE n.nid = 3163
    ORDER BY n.title ASC, u.access DESC' at line 12
    mysql>

    Thanks,
    Kevin

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,322
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    the left join to pv is missing its ON clause
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2004
    Location
    Utah, USA
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    the left join to pv is missing its ON clause
    Thank you!


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
  •