Sqlite in Ionic?

Hey, I am using SQlite in Ionic 3. I want to get an Id from table 1 and pass that onto table 2 in order to get some data. Alert is showing that Initially for loop of table 1 initiates and then after getting all values it passes that data onto next table. I am getting answer but it prints for example: Question #01 and all answers than it prints Question #02 than all answers.


Thank You.

use a join query only like

select * from all_questions q join survey_results s on q.qid=s.qid where q.sid=?

Hey thanks mate but could you help me in another thing ? How can i display results like,
Question 1 gives answer 1.
Question 2 gives answer 2.
But what if Question 3 gives multiple answers ? In this condition i want to print my question once and its answer.
Thank you