Converting an SQL command with sub-query using a 2-argument selection