MySQL Syntax

Richard Korts
Richard Korts used Ask the Experts™
on
What is wrong with this syntax?

SELECT lname, number, comm from `ol_res_discount` o, fname, email, street from resv r where r.confno = o.confno

The MySQL Error message is:

MySQL said: Documentation
#1064 - 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 'from resv r where r . confno = o . confno  LIMIT 0, 30' at line 1

Table structures attached.
ol-res-discount.jpg
resv.jpg
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2011
Commented:
SELECT o.lname, o.number, o.comm,r.fname, r.email, r.street  from ol_res_discount o, resv r 
where r.confno = o.confno 

Open in new window


You can also use INNER JOIN

SELECT o.lname, o.number, o.comm,r.fname, r.email, r.street  from ol_res_discount as o INNER JOIN  resv as r 
ON o.confno = r.confno 

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial