0

I have a table as follows,

A   A  
B   B1  
A   A1  
B   B  
A   A2  
B   B3  
A   A3  
B   B2  

My result set should be,

A   A  
A   A1  
A   A2  
A   A3  
B   B  
B   B1  
B   B2  
B   B3  

Note: A, A1 are all GUIDs.

I have tried quite a few tricks. Please help me solve this problem.

5
  • Are those 2 columns or is it 1 column with a space in the value? Commented Jul 23, 2010 at 20:19
  • Two columns, but A, A1 are all GUIDs Commented Jul 23, 2010 at 20:23
  • 1
    @user400638: Don't abstract necessary details from the question, and don't use tabs for formatting in the future. Commented Jul 23, 2010 at 20:25
  • why on earth would you care to sort by a GUID? they are just random values! Commented Jul 23, 2010 at 20:47
  • 1
    This is effectively not a Sort, this is a grouping of them. Commented Jul 24, 2010 at 4:41

2 Answers 2

5

I'm assuming that the spaces indicate separate columns.

select * from [Table] order by [column1], [column2] 

If each line is a string then doing an order by [column1] should be sufficient.

Sign up to request clarification or add additional context in comments.

Comments

2

Maybe I am missing something, but I figured this would be: ORDER BY Column1, Column2

Perhaps you could explain this further?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.