select一个老师对应的年龄最大的学生

来源:百度知道 编辑:UC知道 时间:2024/05/15 12:04:50
有两个表,老师,学生
两表之间的内部联系为老师-ID

如何写这个表达式

select (select 老师name from 老师 where 老师id = c.老师id), * from 学生 as c where 学生id in (select top 1 学生id from 学生 where 老师id = c.老师id order by 学生age desc)

表里都有哪些字段?问题不清楚的。

select 老师-ID
from 老师表
where 老师id in (select 老师-ID from 学生表 where 学生id='最大')