Skip to main content

I want to write PQL that gives me number of instances of object type O1 which is related to n instances of object type O2. Ex: Number of Purchase Order which is related to 2 instances of payment. There is no 1:N relation between these table. In this scenario, is it still possible to get number of instances of one object based on how many times it is related to other object type?

I think your solution will be including PU_COUNT and some case when. Question is: why is there no relationship if you want to bring them together now? DOMAIN_TABLE could be of help to bring the relationship together in runtime.

A first draft might if there is a relationship would be:
COUNT(CASE WHEN PU_COUNT(O1, O2.ID) =2 THEN 1 END)


@manuel.wetze There is relationship between two tables but not direct 1:N, Suppose, I have Purchase Order which is related to Payment and I want to find number of instances of Purchase Order which is related to more than one payment. It gives error below

 


Reply