我有 2 张 table
emp (id , name)
cust(id, name)
现在我想要结果中的行数
q=select emp.id from emp,cust where emp.id not in (select id from cust);
为此 我提出查询:
select count(*)
from (select emp.id
from emp,cust
where emp.id not in (select id from cust));
但是我收到错误:
Every derived table must have alias name"
计算 q 结果中的行数的正确查询是什么?
最佳答案
使用别名;
select count(*) from
(
select emp.id from emp where emp.id not in (select id from cust)
)A;
关于mysql - 如何计算派生表中的行数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24190800/