sql 中with 语句使用

2018-10-23  本文已影响0人  孙沛2010

参考http://blog.sina.com.cn/s/blog_9e0bd57301016mru.html

多个子句时,

with branch_total(branch_name,val)as

(select branch_name,sum(balance)

fro m account

group by branch_name),             //逗号不可少

branch_total_avg(val)as

(select avg(val)

fro m branch_total)

select branch_name

fro m branch_total,branch_total_avg

where branch_total.val>=branch_total_avg.val

并且上一条语句必须以‘;’结尾

上一篇 下一篇

猜你喜欢

热点阅读