melo Posted March 17, 2013 Share Posted March 17, 2013 Hi! Can someone help me here? I just got this code from other topics and use it for my system but i have a problem $idList = join (',', array_map('intval', array_keys($_POST['answers']))); $sql = "SELECT QuestionId, answer FROM tblquestion_mc WHERE QuestionId IN ($idList"; what i am trying to do is to join my table: tblquestion_default to that code above but i don't know how to. My tables contain this: table name: tblquestion_mc QuestionId | Answer table name" tblquestion_default QuestionId | Answer Link to comment https://forums.phpfreaks.com/topic/275771-joining-two-tables-with-the-same-rows/ Share on other sites More sharing options...
rgopal101 Posted March 17, 2013 Share Posted March 17, 2013 Plz Say me what you want output of join two tables Link to comment https://forums.phpfreaks.com/topic/275771-joining-two-tables-with-the-same-rows/#findComment-1419155 Share on other sites More sharing options...
melo Posted March 17, 2013 Author Share Posted March 17, 2013 I need to get the answers from the two tables Link to comment https://forums.phpfreaks.com/topic/275771-joining-two-tables-with-the-same-rows/#findComment-1419156 Share on other sites More sharing options...
jcbones Posted March 18, 2013 Share Posted March 18, 2013 Try: SELECT o.QuestionId, o.Answer AS Answer1, t.Answer AS Answer2 FROM tblquestion_mc AS o JOIN tblquestion_default AS t ON o.QuestionId = t.QuestionId WHERE o.QuestionId IN ($idList); Link to comment https://forums.phpfreaks.com/topic/275771-joining-two-tables-with-the-same-rows/#findComment-1419242 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.