2
如何可以提取從下表中特定束產品訂單。例如,如果我想提取產品Wireless Mouse
已被用作捆綁產品的所有訂單。提取特定束產品訂單
期待結果1:
orders_id product_name qty 1000 Wireless Mouse 1 1000 Laptop 1 1001 Wireless Mouse 3 1001 PC 3 1003 Wireless Mouse 4 1003 IPAD 4
第二個問題:
,如果我想只提取產品的訂單,其與「無線鼠標」作爲包我該怎麼辦呢?
期待結果2:
orders_id product_name qty 1000 Laptop 1 1001 PC 3 1003 IPAD 4
如果可能的話,請幫我瞭解以下信息:
,如果我想提取它們與「無線鼠標」,僅使用「筆記本」的訂單作爲捆綁我該怎麼做?
期待結果3:
orders_id product_name qty 1000 Laptop 1
實施例的數據:
表1:訂單
id customer_id order_price purchase_date 1000 1 203 12/6/2011 1001 2 304 12/6/2011 1002 1 1000 12/6/2011 1003 1 233 12/6/2011 1004 1 44 12/7/2011 1005 3 50 12/7/2011 1006 4 67 12/7/2011 1007 5 99 12/7/2011 1008 6 299 12/7/2011 1009 7 199 12/7/2011
表2:客戶
id email name 1 [email protected] james 2 [email protected] Ryan 3 [email protected] Sili 4 [email protected] Mame 5 [email protected] Kane 6 [email protected] Kratos 7 [email protected] Kim
表3:產品
id name 1 Laptop 2 PC 3 Wireless Mouse 4 IPAD 5 iphone 6 Wireless Keyboard 7 Printer 8 Glaxy S3 9 Scanner 10 PS3
表4:product_orders
id orders_id product_id qty 1 1000 1 1 2 1000 3 1 3 1001 2 3 4 1001 3 3 5 1003 4 4 6 1003 3 4 7 1004 5 1 8 1005 6 1 9 1007 7 2 10 1008 8 1
對不起你們,我今天問太多。
感謝您的幫助。一件有趣的事是,我不知道<>是「不相等」。我今天從你那裏學到了很多東西。再次感謝。 – Anam