Quote:
Originally posted by n_i
I think it should look something like this:
select a.dbid, a.data, c.data, d.data
from
tableC c, tableD d, tableA a
left outer join links l1 on a.dbid=l1.parent_dbid
left outer join links l2 on a.dbid=l2.parent_dbid
where
l1.CHILDTYPE = 16781452
and l2.CHILDTYPE = 16781502
and l1.child_dbid=c.dbid
and l2.child_dbid=d.dbid
and coalesce(c.data, d.data) is not null;
|
Thats really close but its not pulling enough documents =( It gets 400something when the original got 900something.
Did this:
SELECT A.DBID, B.NAME, C.NAME_HOST, D.APPLICATIONNAME
FROM
udbucm.STATEDEF B, udbucm.HOST C, udbucm.APPLICATION D, udbucm.InfraChange A
left outer join udbucm.PARENT_CHILD_LINKS l1 on A.dbid=l1.parent_dbid
left outer join udbucm.PARENT_CHILD_LINKS l2 on A.dbid=l2.parent_dbid
where
l1.CHILD_ENTITYDEF_ID = 16781452
and l2.CHILD_ENTITYDEF_ID = 16781502
and l1.child_dbid = c.dbid
and l2.child_dbid=d.dbid
and coalesce(C.NAME_HOST, D.APPLICATIONNAME) is not null
and A.STATE = B.ID
-----------------------------
That is what pulls 400 =(
it is pulling repeat A.DBIDs (Id say there are only 50 unique A.DBIDs in the whole query when the original pulled 900+) the NAME_HOST are all correct but the majority of APPLICATIONNAME's are all blank