Improving sql_query