A table
--------------------
id bId txnVolume
1 1(b table) 10.00
2 1 5.00
3 2 7.00
4 3 2.00
B table
--------------------
id cId
1 1(C table)
2 2
3 3
C table
--------------------
id cusId prodId
1 1 1
2 1 2
3 1 1
4 1 2
我想獲得表A上txnVolume的總和,如果C表是custId 1和prodId 1?謝謝你們的幫助!乾杯!如何SUM查詢3個表格?
我可以很容易地編寫這個查詢你,但請告訴我們您的嘗試。你如何在MySQL查詢中「鏈接」表? – 2013-02-20 13:10:20
考慮:http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html – xQbert 2013-02-20 13:15:38