Is that giving you an error? (it should be) If so, what?
After splitting it out, I can see that you have made two major mistakes.. you have not specified all of the tables that are needed (for example, r_highway is not in there), and you have not joined to/from apt tables (eg: you effectively join r_business to itself).
For simplicity, I have removed $prefix from the following.
These parts are valid:
..as each table is listed just once (after FROM or JOIN) and the ON clauses specify fields that are in the tables which are already listed.Code:FROM r_business INNER JOIN r_category ON r_category.catid = r_business.catid
This part would be valid if you had r_highway already joined:
This is how it should be:Code:INNER JOIN r_state ON r_state.stateid = r_highway.State
Code:FROM r_business INNER JOIN r_category ON r_category.catid = r_business.catid INNER JOIN l_exitbusiness ON l_exitbusiness.busid1 = r_business.BusinessID INNER JOIN r_exit ON l_exitbusiness.exitid = r_exit.ExitID INNER JOIN r_highway ON r_exit.highwayid = r_highway.HiwayID INNER JOIN r_state ON r_state.stateid = r_highway.State




Reply With Quote