Ordering of SQL statements