如何使用oracle将外部查询表别名连接到内部子查询中

时间:2018-07-18 06:37:13

标签: sql oracle

您好,我的查询量很小,经过多次谷歌搜索后,我正在询问您。请让我知道解决方法。

在这里,我的查询是,我已经联接了两个表,并使其成为具有别名名称的表的结果,并且该表(结果)可以用来与子查询中的另一个表联接吗?

Intent intent = new Intent(Intent.ACTION_DELETE);
intent.setData(Uri.parse("package:com.example.mypackage"));
startActivity(intent);

当我尝试在子查询中使用公用表变量c1时,出现错误。如果无法查询,请告诉我解决方案...

这里的功能是从当前日期到import * as app from "tns-core-modules/application"; const androidApp = app.android; var intent : any = new android.content.Intent(android.content.Intent.ACTION_DELETE); intent.setData(android.net.Uri.parse("package:" +YOUR_APP_URL)); androidApp.foregroundActivity.startActivity(intent); (这是一个日期)之间的小时数,如果可以,有没有几个假期?

2 个答案:

答案 0 :(得分:0)

尝试如下修改您的查询

select * from
(select t1.col1,t1.col2,t2.col3 from tbl1 t1 join tbl2 t2 on t1.col1=t2.col1) cte1
where round(sysdate-cte1.col3)*24>(120+(
select count(distinct holidat_date) from holiday_tbl hm where cte1.location=hm.location
and hm.location="ABC")*24)

答案 1 :(得分:0)

首先,cte1不返回任何称为location的东西。因此,这是必需的。

第二,hm未定义。

第三,where的子查询中的语法不太正确:

select *
from (select t1.col1, t1.col2, t2.col3, ?.location
      from tbl1 t1 join
           tbl2 t2
           on t1.col1 = t2.col1
     ) cte1
where round(sysdate - cte1.col3) * 24 >
      (120 +
        (select count(distinct holidat_date)
         from holiday_tbl hm join 
         where hm.location = cte1.location and
               hm.location = 'ABC'
        ) * 24
       )