Adding a third table to a Join

FloffnoniPalp

New Member
This query works fine:\[code\]$sqlStr = "SELECT s.loginid, s.title, s.url, s.displayurl, l.username FROM submission AS s, login AS l WHERE s.loginid = l.loginid ORDER BY s.datesubmitted DESC LIMIT 10";\[/code\]Would this work if I wanted to join a third MySQL table (called "comment") to it?\[code\]$sqlStr = "SELECT s.loginid, s.submissionid s.title, s.url, s.displayurl, l.username, count(c.comment) countComments FROM submission AS s, login AS l, comment AS c, WHERE s.loginid = l.loginid AND s.submissionid = c.submissionid ORDER BY s.datesubmitted DESC LIMIT 10";\[/code\]Thanks in advance,John
 
Back
Top