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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.