Discussion Locked

sql query

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

i have table that contain appointmentdate and FirstName and LastName i need sql Query for sorting

i have records like

AppointmentDate FirstName LastName
10/1/2009 2.00 Munish Rathore
10/1/2009 3.20 Munish Rathore
10/1/2009 3.50 Munish Rathore
10/1/2009 4.50 Munish Rathore
10/1/2009 3.50 Sandeep Shanrma
10/1/2009 4.50 Sandeep Shanrma
10/1/2009 3.50 Vicky Shanrma
10/1/2009 4.50 Vicky Shanrma

Now i want to show in Grid in particular
sorting order
10/1/2009 3.50 Munish Rathore
10/1/2009 4.50 Sandeep Shanrma
10/1/2009 4.50 Vicky Shanrma
after then all repeat records
10/1/2009 2.00 Munish Rathore
10/1/2009 3.20 Munish Rathore
10/1/2009 3.50 Munish Rathore
10/1/2009 3.50 Sandeep Shanrma
10/1/2009 3.50 Vicky Shanrma

10/1/2009 3.50 Munish Rathore
10/1/2009 4.50 Sandeep Shanrma
10/1/2009 4.50 Vicky Shanrma
10/1/2009 2.00 Munish Rathore
10/1/2009 3.20 Munish Rathore
10/1/2009 3.50 Munish Rathore
10/1/2009 3.50 Sandeep Shanrma
10/1/2009 3.50 Vicky Shanrma

Means all single unique first and last name will merge

Thanks

3 replies

by shellbot

But I'm not really getting what your asking for here...

What is it you want to sort on? And whats the deal with the "repeat records" showing after the first group..

Your putting this in 1 grid yes?

by tony hopkinson

is far from obvious from what you've presented.

If you want to to have one result set with invisble sections sorted differently say

Mynames
Fred 1
Bill 2
Alfie 3

Fred 1
Bill 2
Alfie 3
Alfie 3
Bill 2
Fred 1

Not a clue why you would but if you did...

Select Name,SortOrder From MyNames Order By SortOrder
UNION
Select Name,SortOrder From MyNames Order By Name

would do it.

This discussion is closed to new replies.