我正在跟踪连锁店的杂货价格,并且我在MySQL声明中遇到了问题。MySQL需要加入杂货店,UPC代码和价格表
我的三个表设置像如下: 1)upccode_table,具有两个字段:upc_code,ITEM_NAME
2)storelist_table,具有三个字段:store_code,STORE_NAME,store_address
3)price_table,有四个字段:upc_code,store_code,price_amount,price_date
我需要我的price_table来显示/返回所有可能的组合!这包括所有UPC代码和所有商店名称,以及所有price_amounts,即使为NULL。
我的数据输入将用真实值替换NULL值。
我第一次刺穿这个,但我的语法不正确。
select itemlist.upccode as Code, storetable.storecode as Number
from code itemlist
inner join Pricelist p on itemlist.upccode = pricelist.upccode
inner join storenumber s on storetable.storenumber = pricelist.storenumber
order by itemlist.upccode
LEFT JOIN得到即使他们缺少价目表或商店 – 2011-04-20 19:56:12