No column name was specified for column xx
报错语句示例:
select * FROM (
select d.dept_name,count(1) from sys_dept d GROUP BY d.dept_name
) as temp
报错原因:
因为加了临时表(新表),所以要指出新表的每一列的列名,例子中应该为count(1)定义别名
正确写法:
select * FROM (
select d.dept_name,count(1) as count from sys_dept d GROUP BY d.dept_name
) as temp