Jump to content
Sign in to follow this  
tlalochj

Error 1066 - Not unique table/alias: 'pd'

Recommended Posts

I have this error message whet I try to search or make an advanced search , I install the Products Extra field Contribution, When I change the original files with the search and advanced search files of the products extra field contribution I have a error message Product not foun And If I put the original search and advanced search the error message tha appears it's

 

1066 - Not unique table/alias: 'pd'

select count(distinct p.products_id) as total from (products p left join products_to_products_extra_fields p2pef on p.products_id=p2pef.products_id) left join manufacturers m on m.manufacturers_id=p.manufacturers_id, products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c, products_extra_fields pef, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '3' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and pef.products_extra_fields_id=p2pef.products_extra_fields_id and ((pd.products_name like '%harry%' or p.products_model like '%harry%' or m.manufacturers_name like '%harry%' or pef.products_extra_fields_name like '%harry%' or p2pef.products_extra_fields_value like '%harry%') )

[TEP STOP]

 

 

Somebody can help me

Share this post


Link to post
Share on other sites

I am having the same problem too. Although I dont have the products extra field.

 

Anyone have any idea on this? Or do any of you guys who have had the same problem found a fix?

 

Cheers

Fiona


Worse things happen at sea

Share this post


Link to post
Share on other sites
I am having the same problem too. Although I dont have the products extra field.

 

Anyone have any idea on this? Or do any of you guys who have had the same problem found a fix?

 

Cheers

Fiona

 

this a MySQL 5 issue so I presume you are all using MySQL 5. If so I'll try and dig around to see if there is a solution..

Share this post


Link to post
Share on other sites
I have this error message whet I try to search or make an advanced search , I install the Products Extra field Contribution, When I change the original files with the search and advanced search files of the products extra field contribution I have a error message Product not foun And If I put the original search and advanced search the error message tha appears it's

 

1066 - Not unique table/alias: 'pd'

select count(distinct p.products_id) as total from (products p left join products_to_products_extra_fields p2pef on p.products_id=p2pef.products_id) left join manufacturers m on m.manufacturers_id=p.manufacturers_id, products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c, products_extra_fields pef, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '3' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and pef.products_extra_fields_id=p2pef.products_extra_fields_id and ((pd.products_name like '%harry%' or p.products_model like '%harry%' or m.manufacturers_name like '%harry%' or pef.products_extra_fields_name like '%harry%' or p2pef.products_extra_fields_value like '%harry%') )

[TEP STOP]

Somebody can help me

 

You are trying to redeclare an alias; this is not allowed. You already stated TABLE_PRODUCTS_DESCRIPTION is pd and don't need to do it again. I see you will get the same error for 'c' and 'p2c' as well. Remove the duplicate alias and you should be fine.

 

 

products_description pd, categories c, products_to_categories p2c

Share this post


Link to post
Share on other sites
You are trying to redeclare an alias; this is not allowed. You already stated TABLE_PRODUCTS_DESCRIPTION is pd and don't need to do it again. I see you will get the same error for 'c' and 'p2c' as well. Remove the duplicate alias and you should be fine.

 

 

products_description pd, categories c, products_to_categories p2c

 

What file do we make this edit in?

Share this post


Link to post
Share on other sites
You are trying to redeclare an alias; this is not allowed. You already stated TABLE_PRODUCTS_DESCRIPTION is pd and don't need to do it again. I see you will get the same error for 'c' and 'p2c' as well. Remove the duplicate alias and you should be fine.

 

 

products_description pd, categories c, products_to_categories p2c

 

I'm having the exact same problem as well, and I also just installed the Product Extra Fields contribution. Any help on how exactly to go about removing the duplicate alias would be greatly appreciated!

 

(and yes, I am using MySQL 5)

Edited by CrazedRabbit

Share this post


Link to post
Share on other sites
I'm having the exact same problem as well, and I also just installed the Product Extra Fields contribution. Any help on how exactly to go about removing the duplicate alias would be greatly appreciated!

 

(and yes, I am using MySQL 5)

 

change

 $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

to

 

  $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " , " . TABLE_CATEGORIES . " , " . TABLE_PRODUCTS_TO_CATEGORIES . " ";

Edited by Job

Share this post


Link to post
Share on other sites

Thank you for this help but I am still getting the same error.

 

I installed

 

http://addons.oscommerce.com/info/3521

 

Because I need separate names for the different languages of my manufacturers. I followed the Install Manual but now it get the following error after installing the above Add-On, when I click onto a category ie:

 

http://organicbeauty.ch/index.php/cPath/71

 

I get this error:

 

1054 - Unknown column 'm.manufacturers_name' in 'field list'

 

select p.products_quantity, p.products_weight, m.manufacturers_name, p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from ((products_description pd, products p) left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c) left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '71' order by pd.products_name limit 0, 20

 

Any help is greatly appreciated.

 

Best

Zeno

Share this post


Link to post
Share on other sites

Ok got it to work on my local Machine!

 

See

http://forums.oscommerce.com/index.php?s=&...t&p=1321889

 

If you have "1054 - Unknown column 'p.products_id' in 'on clause'" problems do the "()" after 'from' and before 'left join' according to http://forums.oscommerce.nl/index.php?show...44444&st=0# and according to the AddOn http://www.oscommerce.com/community/contributions,4654

 

Best

Zeno

Share this post


Link to post
Share on other sites

I have installed the product extra field, and had the same problem, this fixed the situation:

 

$from_str = "from (" . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " p2pef on p.products_id=p2pef.products_id) 
left join " . TABLE_MANUFACTURERS . " m on m.manufacturers_id=p.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . "
s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 

changed to:

 

  $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " p2pef on p.products_id=p2pef.products_id 
left join ". TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";

 

hope this helps.

Edited by ureche

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×