码上敲享录 > sqlserver实战经验分享 > No column name was specified for column

No column name was specified for column

上一章章节目录下一章 2020-12-05已有1469人阅读 评论(0)

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


0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交