SELECT inside a WHERE clause?

I have a need to select rows from a table based on a select from another table, for example:

SELECT * FROM Table1 WHERE UserId IN (SELECT Id FROM Users WHERE AccessLevel = 2)

How would I go about doing this with dynamic where?

Hello

Unfortunately it is not possible to express such WHERE statements via Dynamic Where.

Ah ok fair enough. I guess my only options are either to create a separate table in my schema with this SQL or first query the sub-table to retrieve the IDs then supply these in a query to the main table as an IN clause using dynamic where.

Yes, these options will work.

Also (for .NET-based servers) it is possible to use DA SQL queries, as they support sub-selects.