连接两个表并从Mysql中的新表中检索记录

时间:2017-06-09 00:31:22

标签: mysql

我有两个表学生(crn,年龄,姓名)和帐户(crn,account_id,费用)。我想获得年龄小于20岁的学生的account_id。我怎样才能在MySQL中这样做?

1 个答案:

答案 0 :(得分:0)

SELECT account_id, name, age 
FROM student s inner join account a on s.crn = a.crn
where age < 20