SQLServer中with问题
在SQLServer2000中,用with定义一个临时表,查询分析器报错说with附近有语法错误
不知道在SQLServer2000是否持with这样的用法?
错误在哪里?
with counter_company(works_num,company_name) as
select count(person_name),company_name
from works
group by company_name
select works_name
from counter_company
------解决方案--------------------不支持,在05的功能
------解决方案--------------------定义临时表
select count(person_name) works_num,company_name
into #counter_company
from works
group by company_name
使用临时表
select works_name
from #counter_company