我的问题类似于SQL select Group查询.但架构有变化,我想要不同的结果,如下所述.给定链接的解决方案并没有给我正确的解决方案.您可以使用SQL小提琴来解决此问题.
下面是我的表
表格1
+--------+----------+---------+
| amount | make | product |
+--------+----------+---------+
| 100 | Nokia | Mobiles |
| 300 | Samesung | Mobiles |
| 700 | Micromax | Mobiles |
| 1000 | Karbonn | Mobiles |
| 300 | Lava | Mobiles |
| 100 | Floyer | Gift |
| 500 | Arichies | Gift |
| 300 | Feeling | Gift |
+--------+----------+---------+
Run Code Online (Sandbox Code Playgroud)
现在我想显示每个产品的两个最低金额,如果金额相同,则根据make列的升序字母顺序排列任何人...
所以我想构建单个SQL查询,它给出了如下结果.
+--------+----------+---------+
| amount …
Run Code Online (Sandbox Code Playgroud)