本文介绍了我们可以有多个"WITH AS"吗?在单个sql中-Oracle SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的问题:oracle是否在单个sql语句中允许多个"WITH AS".

I had a very simple question: Does oracle allow multiple "WITH AS" in a single sql statement.

示例:

WITH abc AS( select ......)

WITH XYZ AS(select ....) /*This one uses "abc" multiple times*/

Select ....   /*using XYZ multiple times*/

我可以通过多次重复同一查询来使查询工作,但是不想这样做,并利用"WITH AS".看来这是一个简单的要求,但是oracle不允许我这样做:

I can make the query work by repeating the same query multiple times, but do not want to do that, and leverage "WITH AS".It seems like a simple requirement but oracle does not allow me:

推荐答案

您可以这样做:

WITH abc AS( select
             FROM ...)
, XYZ AS(select
         From abc ....) /*This one uses "abc" multiple times*/
  Select
  From XYZ....   /*using abc, XYZ multiple times*/

这篇关于我们可以有多个"WITH AS"吗?在单个sql中-Oracle SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 18:57