One way would be
if object_id('test_q') is not null
drop table test_q
go
create table test_q(
m char(3),
b int,
l int
)
insert into test_q (m,b,l) values('10',10,1)
insert into test_q (m,b,l) values('10',10,2)
insert into test_q (m,b,l) values('10A',10,2)
insert into test_q (m,b,l) values('10',10,3)
select * from test_q order by m desc,b,l
m b l
---- ----------- -----------
10A 10 2
10 10 1
10 10 2
10 10 3
(4 row(s) affected)
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]