Select Queries in Where Clause

Added code to allow Select Query to be used in Where Clause.