changed sql query style