Below are the two database tables
tbl_questions
1 2 3 4 5 6 7 8 9 10 11 12 |
CREATE TABLE IF NOT EXISTS `tbl_questions` ( `id` int(10) NOT NULL, `question` varchar(250) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_questions` -- INSERT INTO `tbl_questions` (`id`, `question`) VALUES (1, 'Prime minister India'), (2, 'President of India'); |
tbl_answer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<pre class="lang:mysql decode:true " >CREATE TABLE IF NOT EXISTS `tbl_answer` ( `id` int(10) NOT NULL, `question_id` int(10) NOT NULL, `answer` varchar(250) NOT NULL, `status` varchar(3) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_answer` --</pre> INSERT INTO `tbl_answer` (`id`, `question_id`, `answer`, `status`) VALUES (1, 1, 'Narendra Modi', 'y'), (2, 1, 'Manmohan singh', 'n'), (3, 1, 'Sonia Gandhi', 'n'), (4, 1, 'Rahul gandhi', 'n'), (5, 2, 'Pranabh Mukherji', 'y'), (6, 2, 'Prakash karat', 'n'), (7, 2, 'Sasi tharoor', 'n'), (8, 2, 'APJ abdul Kalam', 'n'); |
tbl_questions
tbl_answer
Output would be like this
i need to get ouput as above, anybody is there to help. please comment….