Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
DJJUBES
Starting Member
4 Posts |
Posted - 2012-05-20 : 14:49:37
|
| I am trying to display all the distinct orders where the quantity is in the bottom quartile (in otherwords, show all the orders which is in the lowest quarter of orders – lowest 25%)I am working on a Database called Northwind and the columns to include are OrderID and ProductIDResults should look something like this OrderID .ProductID 10609 . 1 10700 . 1 10722 . 2 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-20 : 15:42:36
|
| [code]SELECT columns...FROM(SELECT *,NTILE(4) OVER (ORDER BY OrderQty ASC) AS QrFROM table)tWHERE Qr = 1[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|