简体   繁体   English

在查询中的oracle中创建临时表

[英]creating temporary tables in oracle in query

IN mysql you have something like this: 在mysql中,您有类似以下内容:

Select * from    (select * from t1, t2 where t1.c1=t2.c1 ) tbl1 ,tbl2
where tbl1.col1=tbl2.col2;

is there anything in like this in oracle, because when I am trying to do same thing in oracle I am getting this error : invalid identifier "tbl1"."col1". 在oracle中有没有类似的东西,因为当我尝试在oracle中做同样的事情时,出现此错误:无效的标识符“ tbl1”。“ col1”。

Try this way: 尝试这种方式:

Select tbl1.col1
from (select c1 as col1 from t1, t2 where t1.c1=t2.c1 ) tbl1 ,tbl2
where tbl1.col1=tbl2.col2;

Here you can find more information. 在这里您可以找到更多信息。

Try this: 尝试这个:

Select tbl1.*, tbl2.* 
from (
  select t1.c1 as col1, t2.* from t1, t2 where t1.c1=t2.c1 
) tbl1 ,tbl2
where tbl1.col1=tbl2.col2;

Because you join 2 tables * doesn't work. 因为您加入了2个表,所以*不起作用。 Use tbl1.* and tbl2.* instead. 请改用tbl1。*和tbl2。*。

As already suggested by Parado you also have to rename t1.c1 to col1 in your inner select. 正如Parado所建议的那样,您还必须在内部选择中将t1.c1重命名为col1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM