little fix sql query