gpt4 book ai didi

sql - 如何使用 With 语句创建 View ?

转载 作者:行者123 更新时间:2023-12-04 16:10:30 25 4
gpt4 key购买 nike

我有一个查询,开头包含以下内容:

; 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

最佳答案

withcreate 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com