1 year ago
#372985
Vemala Valas
How can I add values from other columns and other tables into into this correlated subquery?
How can I include worker name and department name column from the other table into the correlated subquery below? The table should show the worker id and names from workers whose work is not null.
Table Worker: col:name Schmitz Wolfgang
Table: Department col: dept_name Counselling Diagnosis
Table Work: col:work project leader group leader null project leader
The correlated subquery below is from the table 'Work'.
select worker_id from work AS a
where not work is null and exists
(select *
from work as b
where a.worker_id = b.worker_id
and a.work != b.work
)
I have tried with nested subqueries and still does not work.
tsql
correlated-subquery
0 Answers
Your Answer