Eng 5571 subquery

DO NOT MERGE UNTIL Paul and I agrees.