我有以下查询向我展示给定base_objectid的行数:
Select Count(*)
from
(
select di.id, di.archkey, dc.mimetype, dc.film, dc.blip, dc.originalfilename, stp.id as baseID, null as Volume, stp.path as Dateiname_org, stp.basepath as Pfad, stp.filelength as Dateilaenge
, 1 as "Dateinummer", dc.idx
from
doc_instance di
, doc_content dc
, sto_hydstorageplace stp
where
di.baseobjectid = :base_objectid
and stp.archivekey = di.archkey
and di.id = dc.docinstanceid (+)
and stp.imagenr = dc.idx
union
select di.id, di.archkey, dc.mimetype, dc.film, dc.blip, dc.originalfilename, stf.id as baseID, stf.volume as Volume, stf.filename as Dateiname_org, stol.confvalue as Pfad, stf.filesize as Dateilaenge
, stf.fileno as "Dateinummer", dc.idx
from
doc_instance di
, doc_content dc
, sto_storagefileentry stf
, sto_storagelevelconf stc
, sto_storagelevelconfentry stol
where
di.baseobjectid = :base_objectid
and stf.archkey = di.archkey
and stf.storagelevel = stc.storagelevel
and stc.id = stol.storagelevel
and stol.confkey = 'FILEARCHIVE'
and di.id = dc.docinstanceid (+)
and stf.fileno-1 = dc.idx
) temp
order by archkey, idx
现在我想向我展示属于另一个表的所有base_objectids的行数,因此上述查询必须为base_objectid的每个特定值执行。我假设我必须对子查询进行上述查询,但我的所有试验都失败了。
答案 0 :(得分:0)
据推测,您只需要将select
更改为:
select base_objectid, count(*)
在group by
:
order by
group by base_objectid
并删除限制输出的所有条件。
但很难说。您的查询基本上无法理解,因为:
join
语法。 从不在from
子句中使用逗号。 ALways 使用明确的join
语法。(+)
的外部联接,甚至Oracle也不再推荐使用外部联接。