Home > Back-end >  Grouped by each customer's second big value
Grouped by each customer's second big value

Time:09-20

There is a table, there is a different customer name and the corresponding data (daily customer data inserted into the list (custom, accnum)),
Want to group by (branch) for each user (custom) the second value (accnum), SQL how to write?

CodePudding user response:


Select * from top 1
(select the top 2 custom, the sum (accnum) as hj from a group by the custom order by hj desc) b order by hj

CodePudding user response:

Similar this kind of search, and by the SQL statement, a little disappointing,
I was taken by circulation combined with SQL search statement, compared to fit in
  • Related