I have the following correlated subquery in SQL Server which works fine
select *, [Status]=(select Max([Status]) from Data_121EmailLog o2
where o2.Data_121Id = o1.Data_121Id) from Data_121 o1
You can see what's going on here from this screenshot
However, when I try to add a where clause on the column in the generated subquery it doesn't work
How can I added a where clause on the [Status] column. In my example this should return 1 result as there is only 1 record with a status of 2.