下面是我的表SQL選擇組查詢
表1
+--------+----------+---------+
| amount | make | product |
+--------+----------+---------+
| 100 | Nokia | Mobiles |
| 300 | Samesung | Mobiles |
| 700 | Micromax | Mobiles |
| 1000 | Karbonn | Mobiles |
| 500 | Lava | Mobiles |
| 100 | Floyer | Gift |
| 500 | Arichies | Gift |
| 300 | Feeling | Gift |
+--------+----------+---------+
現在我想顯示每個產品的兩個最高金額...
所以我想建立一個SQL查詢這給我的結果如下..
+--------+----------+---------+
| amount | make | product |
+--------+----------+---------+
| 1000 | Karbonn | Mobiles |
| 700 | Micromax | Mobiles |
| 500 | Arichies | Gift |
| 300 | Feeling | Gift |
+--------+----------+---------+
請幫我建立這樣的查詢..
答案不一般。如果你有100個產品呢? – 2012-07-10 06:29:06