Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with a query


evol79

Recommended Posts

Posted

Hi guys, i hope there's a mysql doc which can help me, because i know very little of it

 

I tweaked this query to suit my needs

 

I am able to reach product's category name, but... i would like to reach parent_id to, can somebody suggest me what to add in this query to include parent_id and it's relative name?

 

$new_products_query =  tep_db_query("select p.products_id, p.products_image, p.products_model, p.products_quantity, p.products_weight, pd.products_name, p.manufacturers_id, p.products_price, p.products_date_added, 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, m.manufacturers_name, pd.products_description, cd.categories_name, p.products_tax_class_id, p2c.categories_id from  " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_CATEGORIES_DESCRIPTION . " cd on p2c.categories_id = cd.categories_id left join " . TABLE_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 = '" . $languages_id . "' and cd.language_id = '" . $languages_id . "' order by cd.categories_id asc limit ". 200000);

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...