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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 does not order by

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2010-04-26 : 01:13:50
Hi

I have a table where I want fo show some rows and order by 2 columns, so I did this...


SELECT TOP 100 PERCENT Model, UserID, ArtnrDescription
FROM dbo.tbl_ShoppingCart
WHERE (UserID = N'123456')
ORDER BY Model, ArtnrDescription



But it only sort the model column, the artnrdescription is still unordered.
What am I doing wrong?

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-04-26 : 01:17:48
The Query looks quites good! I think the problem on your data.
Post your sample data and expected result.

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-04-26 : 01:23:43
or maybe you are using case-sensitive collation and you are expecting it to order by regardless of case ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-26 : 01:32:12
in any case you need to show us some data and explain what you want and what you actually expect

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

magmo
Aged Yak Warrior

558 Posts

Posted - 2010-04-26 : 01:50:50
Sorry for this, I guess it's little to early for me in the morning and my eyes are playing tricks on me, the models had so simular names that it looked like the order by didn't work, but after some cofee I see that there was nothing wrong.... again, sorry :-|
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-26 : 01:54:16
no problem..It happens to all..

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -