|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Get highest count of ItemNr
Got a table with salestatistics and I want to know what ItemNr sold most a certain day. Can anyone help me with the SQL?
|
|
#2
|
||||
|
||||
|
Code:
select top 1 Itemnr
, sum(salesqty)
from salestatistics
group
by Itemnr
order
by sum(salesqty) desc
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Get highest count of ItemNr |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|