mjs87 Posted December 26, 2009 Share Posted December 26, 2009 Hi I am trying to select the document titles stored in a database. However I only want to select the title for a document that belongs to the user that is logged in, furthermore the user (teacher) teaches a maximum of 2 subject I therefore am only selecting documents that belong to subject 1. The problem I am having is that the results are displayed twice. Here are my tables: tblPlan docname doctitle subject uname datecreated datemodified modifiedby tblSubjectUser uname subject subjectnum The Select statement: $uname = $_SESSION['uname']; $sSQLDoc="SELECT tblPlan.docname, tblPlan.doctitle, tblPlan.datecreated, tblPlan.datemodified, tblPlan.modifiedby FROM tblPlan INNER JOIN tblSubjectUser ON tblPlan.subject = tblSubjectUser.subject WHERE (((tblPlan.uname)='$uname') AND ((tblSubjectUser.subjectnum)='1'))"; $rsDoc = mysql_query($sSQLDoc); Link to comment https://forums.phpfreaks.com/topic/186389-duplicated-results-in-query/ Share on other sites More sharing options...
fenway Posted December 28, 2009 Share Posted December 28, 2009 Define "twice" -- are you sure there is a many-to-one relationship/ Link to comment https://forums.phpfreaks.com/topic/186389-duplicated-results-in-query/#findComment-984715 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.