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 |
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2009-05-19 : 12:21:01
|
i have a table like :ColumnA ColumnB PriceRed B 20 Red A 10Red C 20Green C 20Green A 10 i want in SELECT to grt:ColumnA ColumnB PriceRed A 10Red B 20 Red C 20Green A 10Green C 20 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2009-05-19 : 12:28:46
|
| Order by ColumnB, ColumnA |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2009-05-19 : 12:50:44
|
| Close: ORDER BY ColumnA DESC, ColumnB |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-05-19 : 13:11:50
|
| [code]SELECT columns...FROM(SELECT ROW_NUMBER() OVER(PARTITION BY ColumnA ORDER BY ColumnB,Price) AS Seq,*FROM YourTable)tORDER BY Seq[/code] |
 |
|
|
|
|
|