2012-01-20 12 views
0
select * from (select no,item,desc,user from table where no=1) x , 
select no,item,desc,max(item_date),user from table where no=1 group by no,item,desc) y where x.no=y.no 

でそれらのいずれかで機能して2つのクエリに参加し、それがエラーを与える:は、実行後にOracle 11gの

ORA-00904: "Y"."NO" invalid identifier 

答えて

0

あなたが次のことを試すことができます。

select x.*, y.* from 
(select no,item,desc,user from table where no=1) x , 
(select no,item,desc,max(item_date),user from table where no=1 group by no,item,desc) y 
where x.no=y.no 

または:

select x.*, y.* from 

(select no,item,desc,user from table where no=1) x 

left join 

(select no,item,desc,max(item_date),user from table where no=1 group by no,item,desc) y 

on x.no=y.no 

あなたのデータをどのようにしたいかによって左/右/内側結合を使用するもちろん、参加することができます。