Hi

I have three linked tables : store, catalogue, and sales

store : ID_store, store, date
catalogue : ID_product, product
sales : ID_sales, ID_store, ID_product, product, quantity

I would like a view giving me ALL the products in catalogue with the
quantity per store if the store has this product, and zero or null (or
anything) if the store does not have it

ex.:

store 
ID_store 1          2
store    new york   paris
date    2003-10-10  2003-10-11

catalogue 
ID_product   1        2         3
product      table    chair     lamp

sales
ID_sales     1       2       3
ID_store     1       1       2 
ID_product   1       2       3
product      table   chair   lamp
quantity     3       2       4

look for product and quantity in store new york
view
product      table     chair     lamp
quantity     3         2          0

look for product and quantity in store Paris
view
product      table     chair     lamp
quantity     0         0          4


thanks in advance

Philippe


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to