SQL select group query

后端 未结 5 1118
萌比男神i
萌比男神i 2021-02-04 13:32

Below is my Table

Table1

+--------+----------+---------+  
| amount | make     | product |  
+--------+----------+---------+  
|    100 | Nokia    | Mo         


        
5条回答
  •  轮回少年
    2021-02-04 13:51

    select top 2 amount, make, product from table1 
    where product='Mobiles'
    order by amount desc
    union
    select top 2 amount, make, product from table1 
    where product='Gift'
    order by amount desc
    

提交回复
热议问题