MAM 7.6.1.2:
I'm a data analyst by trade, so I tend to think in full-blown SELECT queries, joins, and group by. Whereas in Maximo we seem to deal more in subqueries and conditions.For example, Maximo relationships have conditions / WHERE clauses.


At first, when I saw that WHERE Clause in the relationship, I pictured it as being the main WHERE clause in a full SELECT query on the entire CLASSSTRUCTURE table / Classifications list view (not just a single record / the current record).
select
cl.classstructureid as cl_classstructureid,
cl.classificationid as cl_classificationid,
cl.description as cl_description,
anc.classancestorid as anc_classancestorid,
anc.ancestor as anc_ancestor,
anc.ancestorclassid as anc_ancestorclassid,
hierarchylevels as anc_hierarchylevels
from
maximo.classstructure cl
left join
maximo.classancestor anc
on cl.classstructureid = anc.classstructureid
where
cl.classstructureid = anc.classstructureid
order by
hierarchylevels desc
fetch
first row only

--1 row selected from the entire CLASSSTRCUTRE table.
But I don't think that's how it works.
Instead, I'm wondering if it works like this:
- For each individual record, Maximo creates a subquery that selects from the records in the related table, where the specified fields match:
select
classstructureid,
classificationid,
description,
(select ancestor from maximo.classancestor where classstructureid = cl.classstructureid and rownum = 1)
as anc_ancestor
from
maximo.classstructure cl

--There were actually thousands of records that were returned from the query. But I applied a filter to get just the one record, for the purpose of this question.
I added ROWNUM=1 to the subquery, since in the SELECT clause, SQL subqueries can only return a single record. I'm guessing Maximo might work this way too -- it seems to select an arbitrary CLASSANCESTOR record to join to the original CLASSSTRUCTURE record. Just like I did with ROWNUM=1.
But I suppose it depends on the scenario; some places in Maximo select multiple related records, others just seem to select a single record.
Question:
Is that how relationship conditions work in Maximo? Or am I way off?
I do seem to have a mental block when it comes to these conditions/subqueries.
#Maximo#AssetandFacilitiesManagement