Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inner join in mysql

Status
Not open for further replies.

tonec

Programmer
Sep 25, 2001
1
GB
I have pasted this statement in from access - it works fine in access but not in mysql - there seems to be an error with the join statement - is the syntax diffetent in some way in mysql - or is there a similar graphic tool to access that you can use with mysql - any help would be appreciated

SELECT tblproject.id, tblproject.jobno, tblproject.proOp, tblproject.client, tblClients.Coname, tblproject.Projname, tblproject.BusCat, tblbusiness.buscatgy, tblproject.ProOpdate, tblemployee.empid, tblemployee.fname, tblproject.Projdes, tblproject.Val, tblproject.Startdt, tblproject.Enddt, tblproject.Prob, tblproject.Active, tblemployee.sname, tblproject.archive
FROM (tblbusiness INNER JOIN (tblClients INNER JOIN tblproject ON tblClients.Coid = tblproject.client) ON tblbusiness.catid = tblproject.BusCat) INNER JOIN tblemployee ON tblproject.empid = tblemployee.empid;

thanks
 
Hi tonec,

As a matter of fact I have been working recently on an Access to MySQL conversion and the INNER JOINS have also been bugging me. Anyway I have the solution for you below although I haven't fully tested it.

If you notice each INNER JOIN is dealt with one at a time and in a consistent "JOIN Link" each time. When the first INNER JOIN is done i.e. 'tblClients.Coid = tblproject.client' - it then proceeds to move to the next one 'tblbusiness.catid = tblproject.BusCat' but making sure that one of the tables being joined was the same as the last join (kinda like following the joins one from another). Anywayz, I hope this makes sense as I have spent hrs trying to get my head around it...

SELECT tblproject.id, tblproject.jobno, tblproject.proOp, tblproject.client, tblClients.Coname, tblproject.Projname, tblproject.BusCat, tblbusiness.buscatgy, tblproject.ProOpdate, tblemployee.empid, tblemployee.fname, tblproject.Projdes, tblproject.Val, tblproject.Startdt, tblproject.Enddt, tblproject.Prob, tblproject.Active, tblemployee.sname, tblproject.archive
FROM (((tblClients INNER JOIN tblproject ON tblClients.Coid = tblproject.client) INNER JOIN tblproject ON tblbusiness.catid = tblproject.BusCat) INNER JOIN tblemployee ON tblproject.empid = tblemployee.empid);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top