joejoe099 Posted September 26, 2006 Posted September 26, 2006 Hi There, I did a site for someone over a year ago and he suddenly got the following error when you go into a category: 1052 - Column: 'products_id' in where clause is ambiguous select distinct m.manufacturers_id as id, m.manufacturers_name as name from products p, products_to_categories p2c, manufacturers m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and products_id = products_id and p2c.categories_id = '28' order by m.manufacturers_name [TEP STOP] I have searched for the solution to not end and can't find anything. Unfortunatley he didn't take my advise and do regular backups so I have to fix this thing. Any ideas? Anyone?
Guest Posted September 27, 2006 Posted September 27, 2006 There must be a product_id field in the products_to_categories table as well. I'm not sure where this query is coming from but where you see "products_id" you will need to replace this with either "p.products_id" and/or "p2c.products_id" as appropriate. So you'd have something like: select distinct m.manufacturers_id as id, m.manufacturers_name as name from products p, products_to_categories p2c, manufacturers m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '28' order by m.manufacturers_name When an error occurs citing a field name as being "ambiguous", it is complaining that it can't tell which field you actually want since it exists in multiple tables included in the query. Hope this helps. :)
joejoe099 Posted September 27, 2006 Author Posted September 27, 2006 Strange though, nothing has changed in over a year. It just appeared. Would it have been a problem from the beginning? So where would I edit this?
Guest Posted September 27, 2006 Posted September 27, 2006 Strange though, nothing has changed in over a year. It just appeared. Would it have been a problem from the beginning? Can't comment on that. If this bit of code has remained unchanged then I can't see how this would ever have worked. Unless the database has been altered in some way. :blink: So where would I edit this? Ok, I've just grep'd all the files and have found the query in catalog/index.php. In my version of this file the specific code is qualified correctly (ie. p.products_id and p2c.products_id). Mind you, I have a pretty recent version of MS2.2 (August). Good luck. :)
joejoe099 Posted September 27, 2006 Author Posted September 27, 2006 Ok, I've just grep'd all the files and have found the query in catalog/index.php. In my version of this file the specific code is qualified correctly (ie. p.products_id and p2c.products_id). Mind you, I have a pretty recent version of MS2.2 (August). Good luck. :) Ok, that's it! Give this man a prize! Thank you so very much Bennstein, I appreciate your help!!! Not sure what happened but the index.php file was corrupt. Everything back to normal. Thanks again!!!
Guest Posted September 27, 2006 Posted September 27, 2006 Glad to hear it mate. :) These questions help me learn the product as much as the questioner. :)
spooker8 Posted March 16, 2008 Posted March 16, 2008 Glad to hear it mate. :) These questions help me learn the product as much as the questioner. :) based on this thread , i tried replacing the index.php , but i am still getting the error. FYI 1052 - Column 'selection_column_id' in field list is ambiguous select selection_column_id, selection_column_name from selection_columns left join selection_columns_language USING(selection_column_id) where language_id='5' AND selection_column_id in (select distinct selection_column_id from selection_data_products) and categories_id='6014048' order by selection_sort, selection_column_id; [TEP STOP] thanks
Recommended Posts
Archived
This topic is now archived and is closed to further replies.