mysql - Strange logic in SQL Query -
i have strange case building mysql query:
here is.
- i need sort results based on first_name , last_name
- my expected result using concat(first_name, last_name) in order by
but restricted not use concat in order by. there way can build query
raw sql :
select concat(first_name, last_name) users order concat(first_name, last_name)
cases: first_name can empty
example
first name last name b b c d
now need sort order
ab b cd
try this:
select full_name ( select concat(first_name, last_name) full_name users ) tmp order full_name