Simplify get_last_query()