Home > Database > Mysql Tutorial > SQL with as

SQL with as

WBOY
Release: 2016-06-07 17:44:19
Original
1439 people have browsed it

with temp as( select *From tb_order where Auditing=2 and AuditingTime='2013-04-01' and Flag=2 ) select *from temp where EbayAccountID=21 相当于临时表 temp 分析器可以智能提示 临时表却不能。 临时表 select * into #temp From tb_order where Aud

with temp as(

select *From tb_order where Auditing=2 and AuditingTime>='2013-04-01' and Flag=2
)
select *from temp where EbayAccountID=21
相当于临时表 temp 分析器可以智能提示 临时表却不能。

 临时表

select * into #temp From tb_order where Auditing=2 and AuditingTime>='2013-04-01' and Flag=2

select * From #temp where EbayAccountID=21



declare @flag int=2;
with temp as(

select *From tb_order where Auditing=2 and AuditingTime>='2013-04-01' and Flag=@flag
)
select *from temp where EbayAccountID=21
declare @flag int=2; 这里的分号不可少 否则会报错
关键字 'with' 附近有语法错误。如果此语句是公用表表达式、xmlnamespaces 子句或者更改跟踪上下文子句,香港服务器,香港虚拟主机,那么前一个语句必须以分号结尾。

,香港空间
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template