Jump to content

Doplnění SQL query pro navraceni nazvu kategorie ke zbozi


undeathquarteer

Recommended Posts

Zdravim vsechny,

mam takovy dotaz, do XML exportu pro porovnavace zbozi jsme pridaval polozky jako EAN a Description, jeste bych chtel u kazdeho zbozi vypsat kategorii do ktere nalezi ale asi mam problem s JOINEM mezi bzoim a kategoriemi, tusil by nekdo jak to spravne zapsat?

 

Diky za kazdou radu.


$res = MySQL_Query("
       SELECT
               p.id_product,
               p.quantity,
               p.price,
               p.reduction_price,
               p.reduction_percent,
               p.reduction_from,
               p.reduction_to,
			p.supplier_reference,
               pl.name,
               pl.description_short,
               pl.link_rewrite,
               i.id_image
       FROM {$prefix}product p
       JOIN {$prefix}product_lang pl USING(id_product)
       JOIN {$prefix}image i USING(id_product)
       WHERE i.cover = 1 AND NOT (SELECT COUNT(*)
               FROM {$prefix}category_product cp
               WHERE cp.id_product = p.id_product
                       AND cp.id_category IN($noShowCategory))
       ORDER BY p.id_product", $db); 

Link to comment
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
×
×
  • Create New...