Added upgraded sql code to 1.4 - sorting tags