correcting which aliases are used on the second left join of the column sorting SQL - fixes #25