mysql - 错误代码 : 1146. 表 'fe539.t' 不存在

标签 mysql

我在 MySQL 中遇到以下问题

问题出现在别名“T”

select course_id, sec_id, enrollment 
from (
    select course_id, sec_id, count(ID) as enrollment
    from section natural join takes
    where semester = 'Fall' and year =2009
    group by course_id, sec_id
) as T
where enrollment = (select max(enrollment) from T);

最佳答案

我认为,如果您没有抽牌,您可能会遇到类似以下的情况。

select course_id, sec_id, count(*) as enrollment
        from section s
        join takes t on s.sec_id = t.course_id
        where semester = 'Fall' and year =2009
        group by course_id, sec_id 
        order by count(*) desc 
        limit 1 
;

关于mysql - 错误代码 : 1146. 表 'fe539.t' 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46511256/

相关文章:

php - 如何在 Medoo SQL 语句的 WHERE 子句中写入 "AND"和 "OR"

mysql - 如何检查mysql中是否有一些录音具有相同的名称,但它们的类型不同

使用 apachelounge VC14 构建和 php.net VC11 构建时,php dll 无法加载到服务器中

MYSQL 内连接错误 - 'm.account_no' 中的未知列 'where clause'

PHP - 写入数据库并在设定时间后删除

php - PHP“for循环”上传到数据库

mysql 退出处理程序帮助

php - 在电子表格/Excel 中正确循环查询以按用户分组

php - 按数组的一列从数据库查询中对数组进行排序

php - PDO 插入基于另一个字段的查询