sql server - Select qty of minimum customerID -


product_code  month  qty  area  customerid ------------  -----  ---  ----  ---------- 820300182     01     1    m1    100078 820300182     01     50   m1    100168 820300182     01     20   m1    100188 820300182     01     10   m1    100618 820300182     01     10   m1    100938 820300182     01     20   m1    100988 820300182     01     25   m1    110158 

i want qty of minimum customerid.

e.g.,

product_code  month  qty  area  customerid ------------  -----  ---  ----  ---------- 820300182     01     1    m1    100078 

assuming want find record lowest customerid:

select top 1 [product_code], [month], [qty], [area], [customerid] [table] order [customerid] asc 

if need find record least quantity change order to

order [qty] asc 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -