1金币
参照:一看就会,超有用活字格技能:五十一,将所有有工作流的表,汇总成一张待办事项表
https://gcdn.grapecity.com.cn/fo ... 3&fromuid=55828
(出处: 葡萄城产品技术社区)
按上述贴子的内容学习了下,在内建表里操作没问题,但转到外建表(SQL 2008 R数据库),使用原待办事项的视图语句报错,请高手帮忙看下问题出在哪里了?
原语句:
with cte as (
Select FGC_AssignTo,FGC_State,"请假表" as tablename,id||"请假表" as key,id as "原表ID" from 请假
union all
select FGC_AssignTo,FGC_State,"报销表" as tablename,id||"报销表" as key,id as "原表ID" from 报销
)
select
(select count(*) from cte b where a.key >= b.key) as ID,
tablename as 目标表,
FGC_AssignTo as 执行者,
FGC_State as 状态,
原表ID
from cte as a
order by key
将上述语句复制到外连SQL的视图里保存时报错如下:
|
最佳答案
查看完整内容
语法不太一样,要改一下就好了
with cte as (
Select FGC_AssignTo,FGC_State,'请假表' as tablename,CAST(id AS VARCHAR(2))+'请假表' as key1,id as "原表ID" from 请假
union all
select FGC_AssignTo,FGC_State,'报销表' as tablename,CAST(id AS VARCHAR(2))+'报销表' as key1,id as "原表ID" from 报销
)
select
(select count(*) from cte b where a.key1 >= b.key1) as ID,
tablename as 目标表,
FG ...
|