比方說,我在MySQL的這兩個表:加入兩個表(含計算)
1. table_name的
name
------
Max
John
Sarah
Peter
2. table_money
name | amount | month
-------------------------------
Max | 100 | January
Sarah | 90 | January
Max | 100 | February
Sarah | 90 | February
Peter | 90 | February
如何有SQL查詢看,這樣我就可以得到這樣的表格:
name | total (amount * #month)
-------------------------------
Max | 200
Sarah | 180
Peter | 90
將有一個選擇,一個從,聯接和總數學caluclation。說實話,你還嘗試過什麼,或者你只是想讓我們爲你做? – SomeJavaGuy