I would like to use a subquery to return a column value. How would I construct this query? From the sample data.
If reference flag = 'Yes'
select title from lectures where lecture_id = referenced_lecture_Id
select title from lecture where lecture_id = lecture_id
Lecture_Id Title Referenced_Flag Referenced_Lecture_Id
1 Stress Management Yes 2
2 Stress Managment (CPAP) No
The lecture_id and referenced_lecture_id will be passed from the main query.