Php 在sql中比较列与列
我有两个表,'student'和'teacher'。'student'有两列'roll','class'。'teacher'也有两列'id','class'。我想从'student'表中获取'roll'列的一些值,其中'class'列的某些值将与'teacher'表的'class'列的值匹配。你能给我一个解决方案吗Php 在sql中比较列与列,php,sql,Php,Sql,我有两个表,'student'和'teacher'。'student'有两列'roll','class'。'teacher'也有两列'id','class'。我想从'student'表中获取'roll'列的一些值,其中'class'列的某些值将与'teacher'表的'class'列的值匹配。你能给我一个解决方案吗 **student** **teacher** roll class id class 1 on
**student** **teacher**
roll class id class
1 one 101 one
2 three 102 three
3 five 103 four
从学生名单中选择滚动
内部连接教师T在S.Class=T.Class上
SELECT
student.roll
FROM
student
INNER JOIN teacher ON student.class = teacher.class