我有一个查询,开头包含以下内容:
; With xxx as xxxxx
我无法使用该语句创建 View ,因此保留此语句至关重要。
编辑:这是代码:
; with numbered as (
Select part,taarich,hulia,mesirakabala,
rowno = row_number() OVER (Partition by parit order.by taarich)
From tblMK)
Select a.rowno-1,a.part, a.Julia,b.taarich,as.taarich_kabala,a.taarich, a.mesirakabala,getdatediff(b.taarich,a.taarich) as due
From numbered a
Left join numbered b ON b.parit=a.parit
And b.rowno = a.rowno - 1
Where b.taarich is not null
最佳答案
把with
后 create view
陈述:
create view t2 as
with t as (select 1 as col)
select * from t;
Here是显示此示例的 SQL Fiddle。
关于sql - 如何使用 With 语句创建 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25159477/