mysql - SQL Outer join 2 tables -


i have 2 tables, comp_product , comp_product_marchand.

the comp_product contains product information (description, name, etc..)

the comp_product_marchand contains different prices (product resellers). each reseller has price product. not products

i in 1 sql query each reseller list of products , price (even if reseller doesn't have one)

i have sql query:

select     p.id_product,     pm.price comp_product_marchand pm left outer join comp_product p     on p.id_product = pm.id_product id_marchand = 4 

(where clause demo only)

this sql query returns price products have price, not others... ideas ?

change link between table:

select     p.id_product,     pm.price comp_product p left outer join comp_product_marchand pm     on p.id_product = pm.id_product     , id_marchand = 4 

in way you'll show product , if marchand = 4 has 1 info marchand showed.

i put query on marchand id in on clause because if put in clause you'll cut lines marchand has no product


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -