cheechm Posted October 6, 2008 Share Posted October 6, 2008 Why doesn't this query work? SELECT q.qid, q.cid, q.status, c.name, c.company FROM quote AS q INNER JOIN customers AS c USING (cid) WHERE q.cid = 128 It shows every result from quote and customers instead of just the ones where quotes.cid = 128. Thanks Link to comment https://forums.phpfreaks.com/topic/127257-solved-mysql-inner-join-not-working/ Share on other sites More sharing options...
wildteen88 Posted October 6, 2008 Share Posted October 6, 2008 I think you'll need group the results by the matching column. Eg SELECT q.qid, q.cid, q.status, c.name, c.company FROM quote AS q INNER JOIN customers AS c USING (cid) WHERE q.cid = 128 GROUP BY q.cid Moved to MySQL Help. Link to comment https://forums.phpfreaks.com/topic/127257-solved-mysql-inner-join-not-working/#findComment-658203 Share on other sites More sharing options...
cheechm Posted October 6, 2008 Author Share Posted October 6, 2008 Nope doesn't seem to work. Thanks anyway. Link to comment https://forums.phpfreaks.com/topic/127257-solved-mysql-inner-join-not-working/#findComment-658214 Share on other sites More sharing options...
F1Fan Posted October 6, 2008 Share Posted October 6, 2008 SELECT q.qid, q.cid, q.status, c.name, c.company FROM quote AS q, customers AS c WHERE q.cid = c.cid AND q.cid = 128 GROUP BY q.cid Link to comment https://forums.phpfreaks.com/topic/127257-solved-mysql-inner-join-not-working/#findComment-658218 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.