carlton123
Registered User.
- Local time
- Today, 09:12
- Joined
- Mar 18, 2011
- Messages
- 48
Im looking to display the 4 lowest figuers obviously Min is the lowest but how would you dind the 2nd 3rd and 4th Min or is not possible?
student grade id Amount
bob B- 1 8000
jim A 2 251000
Sam F 3 280000
Joe B+ 4 450000
Kent C 5 650000
dave C 6 280000
SELECT top 4 amount from grades order by amount desc
amount
650000
450000
[COLOR="Sienna"]280000
280000[/COLOR]
SELECT top 4 amount from grades order by amount asc
amount
8000
251000
[COLOR="Sienna"]280000
280000[/COLOR]
SELECT top 4 amount from grades ;
amount
8000
251000
280000
450000
...
However, if I don't include an Order By
I get 4 lowest distinct valuesCode:SELECT top 4 amount from grades ;
Hmmm? Seems Access returns dups if you use an Order By.Code:amount 8000 251000 280000 450000
Please note in earlier posts and responses, to get the Minimums you DO NOT do Order By DESC (that's for Maximums).
Code:amount [COLOR="Red"]8000[/COLOR] [COLOR="Lime"]251000[/COLOR] [COLOR="Magenta"]280000[/COLOR] [COLOR="Sienna"]450000[/COLOR]
Code:student grade id Amount bob B- 1 [COLOR="Red"]8000[/COLOR] jim A 2 [COLOR="Lime"]251000[/COLOR] Sam F 3 [COLOR="Magenta"]280000[/COLOR] Joe B+ 4 [COLOR="Sienna"]450000[/COLOR] Kent C 5 650000 dave C 6 280000
Code:amount [COLOR="Red"]8000000[/COLOR] [COLOR="Lime"]251000[/COLOR] [COLOR="Magenta"]280000[/COLOR] [COLOR="Sienna"]450000[/COLOR]
I think we've got off track here.
Sorting in DESC order will place the highest at the top and the first 4 highest values will be selected.
Leave out the DESC to get the four lowest values.
smallest but in the summary if you put Min now then it shows the Min so I was wondering if you can stipulate 2nd lowest 3rd lowest etc