September 24, 2009 at 11:45 pm
i have table like this.
id schooltname state distict city
--------------------------------------------
1 FL ABC d a
2 FL def d a
3 FL efg d a
4 FL ABC d b
5 FL def d b
6 FL efg d b
7 FL ABC d c
8 FL def d c
9 FL efg d c
10 AB a e d
11 AB b e d
12 AB c e d
11 AB a e e
12 AB b e e
13 AB c e e
how to group by one by one school name and state and district and city
i need output like this:
id schooltname state distict city
--------------------------------------------
1 FL ABC d a
2 FL ABC d b
3 FL ABC d c
4 FL def d a
5 FL def d b
6 FL def d c
7 FL efg d a
8 FL efg d b
9 FL efg d c
10 AB a e d
11 AB a e e
12 AB b e d
11 AB b e e
12 AB c e d
13 AB c e e
Thanks
Dastagiri.D
September 25, 2009 at 12:47 am
Select * from tablename order by schooltname desc,state ,city
September 25, 2009 at 1:15 am
kabi (9/25/2009)
Select * from tablename order by schooltname desc,state ,city
Bit modify the kabi code
select IDENTITY(int, 1,1) AS [ID],schooltname, state, distict, city into #MYTABLE from MYTABLE
order by schooltname desc,state ,city
select * from #MYTABLE
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply