• I'd suggest you read up on how to join tables. You are referencing tables in your correlated subqueries who are aliased in another correlated subquery. This is not possible.

    Example: in the first subquery, you cannot use the table Reference.

    Correlated are also a big no-no: they are very bad for performance.

    edit: if you want people to help you with actually writing a query, you'd want to post the table DDLs and some sample data.

    edit part 2: I rechecked the query in SSMS with some syntax highlighting to make it more readable. I was mistaken: you are not using correlated subqueries but just regular subqueries. Each subquery has Undrawn and Reference table, something I missed in my earlier reply. However, each subquery probably returns more than one row, which is not allowed.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP