I am unable to execute the following query on MySQL: SELECT DISTINCT v.variableid AS variable_id, v.name AS variable_name, v.description AS variable_description, t.trackerid AS tracker_id, t.trackername AS tracker_name, t.description AS tracker_description FROM ox_ad_zone_assoc aza JOIN ox_zones z ON (aza.zone_id = z.zoneid) JOIN ox_banners b ON (aza.ad_id = b.bannerid) JOIN ox_campaigns_trackers ct USING (campaignid) JOIN ox_trackers t USING (trackerid) JOIN ox_variables v USING (trackerid) LEFT JOIN ox_variable_publisher vp ON (vp.variable_id = v.variableid AND vp.publisher_id = z.affiliateid) WHERE z.zoneid = '1' AND v.datatype = 'numeric' Code (markup): I'm getting the following error: You have an error in your SQL syntax near 'ON (aza.zone_id = z.zoneid) JOIN ox_banners b ON (aza.ad_id = b.' at line 11 Please note that this query is not written by me but a part of OpenX Ads system and I'm getting this error in their ads system, but I tried it using PHPMyAdmin too and getting the same error. Please tell me what is the reason of this error. Thanks
make sure all of fields you type is exist. in this case make sure you have zone_id at table ox_ad_zone_assoc and have zoneid at table ox_zones and more btw what version of your mysql?
Thanks for the reply. I have checked and these fields/columns exist in these tables. I have version 3.23.58 of MySQL.
try to group every join such this: FROM (((((((ox_ad_zone_assoc aza JOIN ox_zones z ON (aza.zone_id = z.zoneid)) JOIN ox_banners b ON (aza.ad_id = b.bannerid)) JOIN ox_campaigns_trackers ct USING (campaignid)) JOIN ox_trackers t USING (trackerid))) JOIN ox_variables v USING (trackerid)) LEFT JOIN ox_variable_publisher vp ON (vp.variable_id = v.variableid AND vp.publisher_id = z.affiliateid)) i am not sure mysql3.x support JOIN, that I am very sure MysQL5 is powerfull, support LEFT JOIN, RIGHT JOIN, trigger, storeprocedure why not to change to mysql5?
does MySQL support JOIN? I thought it had to be LEFT JOIN, RIGHT JOIN, INNER JOIN etc. Might be wrong tho :\
Thanks everyone for the help. The code given by Sukosari didn't work either I think I need to upgrade MySQL and it will solve such this problen.