Converting an SQL command that does not contain a sub-query