Problem mit SQL JOIN

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem mit SQL JOIN

    Hi, ich habe ein paar Joins gemacht:
    PHP Code:
    SELECT img.id,
     
    img.name,
     
    DATE_FORMAT(img.date'%d. %M %Y %H:%i:%s') AS usdate,
     
    img.cat,
     
    imginfo.title,
     
    imginfo.location,
     
    imginfo.situation,
     
    imginfo.createdate,
     
    imginfo.viewed,
     
    imginfo.model,
     
    imginfo.processed,
     
    imginfo.simulator,
     
    imginfo.downloaded,
     
    rat.ratings,
     
    rat.count,
     
    com.name,
     
    com.date,
     
    com.comment
     
    com.nr 
    FROM images img ON img
    .id 8  
    INNER JOIN imagesinfo imginfo ON imginfo
    .id img.id 
    INNER JOIN rating rat ON rat
    .id img.id 
    INNER JOIN comments com ON com
    .id img.id 
    leider kommt dort immer dieser Fehler, weiß aber nicht was falsch an der Syntax ist.
    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 'ON img.id = 8 INNER JOIN imagesinfo imginfo ON imginfo.id = img.id INNER JOIN ra' at line 20
    Vielen Dank im Vorraus
    Dulla_Po

  • #2
    Die erste ON-Klausel müsste eig. eine WHERE-Klausel am Ende sein.

    Ein netter Guide zum übersichtlichen Schreiben von PHP/MySQL-Code!

    bei Klammersetzung bevorzuge ich jedoch die JavaCoding-Standards
    Wie man Fragen richtig stellt

    Comment


    • #3
      Jup, vielen Dank!

      Comment

      Working...
      X