Greetings, I explain what I'm trying to do: I have students enrolled in courses. But the system must have the ability that a single student can be in 1 or more courses, the problem is not that because when I register other courses the same student does it well, here comes my need, when I'm going to enroll another course to a student I show the courses available through a select, but it turns out that in the select shows me the course or courses in which the student is already enrolled, should show only the courses in which he is not enrolled, I know that that has to do something with the DISTINCTROW, but in reality I do not know how to raise my SQL statement, in what refers to the tables in the database I will leave the image of where I bring the available courses, the student table, and the table where I keep the inscriptions.