sql - where is something wrong with my query? -
with as StudentTakes (name, id, curriculum_id) (choose name, student.id, course_id Take the student to join.Ed = Student.Id. Select a different name, ID from the student, where in an anonymity (student selection b.name b where b.name = a.name and b.id A.id and A.course_id = b.course_id);
I want to find the student's name
and id
, each of which has the same name with other students, and Students have the same name, they should read in that class which has the same course_id
table takes
in ID
and course_id < / Code>. The table student has
id
and name
. Those students with similar names are 788 and the result of the above question is 755. Can someone explain that when I change the above code, then the result is 788 . With studenttakes (name, id, course_id) (select name, student.id, course_id from le.ad = student.id by joining the student)
select a different name, StudentTakes A to id where a.name (select b.name from StudentTakes b where b.name = a.name and b.id a.id and a.course_id course_id - CHANGE) Order by name;
It appears that your questions are telling you
- There are 755 students, who take the same name (first query) in the same class, and
- 788 students who have at least one class with the same name for each < / Li>
These results are not incompatible incompatible.
Comments
Post a Comment