cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Solution Sage
Solution Sage

Re: How to apply where condition

Hi @LeaRupnik ,

It seems that table1 is not directly related to table packing and table Organization. Can you share the calculation logic of the second row in table1 with id = 2, firma = 11, org = 51?

1.PNG

Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Helper II
Helper II

Re: How to apply where condition

WITH TEMP (PARENT_ID, ID, i) AS
(
SELECT
PARENT_ID,
ID,
1
FROM
DW.ORGANIZACIJA
WHERE
PROGENOT IN (SELECT DISTINCT PROGENOT FROM DW.PAKIRANO)
UNION ALL
SELECT
A.PARENT_ID,
A.ID,
i + 1
FROM
DW.ORGANIZACIJA A,
TEMP T
WHERE
T.PARENT_ID=A.ID
AND A.PARENT_ID IS NOT NULL
AND i < 1000
)
SELECT
DISTINCT
'SISTEMIMPOL' CONCAT ORG1.PROGENOT as parent_id,
ORG1.ORGENOTA AS PARENT,
'SISTEMIMPOL' CONCAT ORG2.PROGENOT as child_id,
ORG2.ORGENOTA AS CHILD,
TEMP.PARENT_ID AS RAZVRSTI_PARENT_ID,
TEMP.ID AS RAZVRSTI_CHILD_ID
FROM
TEMP
INNER JOIN DW.ORGANIZACIJA AS ORG1 ON TEMP.PARENT_ID=ORG1.ID
INNER JOIN DW.ORGANIZACIJA AS ORG2 ON TEMP.ID=ORG2.ID
ORDER BY
RAZVRSTI_PARENT_ID,
RAZVRSTI_CHILD_ID
;

 

this i have in sql. 

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors