select a.first_name from (select *, substr(first_name,length(first_name)-1,1) as last_but_two_word, substr(first_name,length(first_name),1) as last_word from employees) a order by a.last_but_two_word asc,a.last_word asc