I have 2 different tables SECTION and SUBSECTION in a database QUIZ. The SECTION table has 2 columns section_id and section_title, whereas SUBSECTION table has 4 columns section_id, subsection_id(AI), subsection_title, subsection_detail. Now, what I want is that the section_title but the table that needs to be queried is the SUBSECTION table and with the help of the section_id from the SUBSECTION table we would have to fetch the section_title from the SECTION table.
I have tried some of the solutions given over here but I don't know why these aren't working for me. Any help here would be highly appreciated.
You could use IN
in a way that the results from one query can be passed to another.
Perhaps this is an idea:
SELECT section_title FROM section WHERE section_id IN (SELECT section_id FROM subsection WHERE [some condition here to get the correct set of ids from subsection table])
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments