Skip to content
Advertisement

Order by 2 columns with case

I have a query that searches for user in 2 colums firstUser and secondUser and orders them by first and last name:

But this first orders the cases when user is at first user then it orders the case when user is secondUser. Is ther a way to order the whole data by first name and last name no matter if the user is firstUser or secondUser?

Models:

Advertisement

Answer

I’m not entirely sure what the expectation is, is this what you’re going for?

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement