79428058

Date: 2025-02-10 19:12:03
Score: 2
Natty:
Report link

@samhita please check this. @PUTHINEEDI RAMOJI RAO The issue is that using the inner join there are two joins happening. May be someone who know sql will update with a better explanation later. The issue is happening during second join and we dont specify a column to join on. It combines with all rows for each row. I dont know how to explain this may be these diagrams will make it clear. Behind the scene Update is a join.

so if we use below query it will be fine as we specify the ON clause for the second join. I know it may be confusing but it comes down to sql concepts

UPDATE `dde-demo-d001.sap_crm.documents_bkup_copy` trg
    SET case_guid = ICT.case_guid
    FROM `dde-demo-d001.sap_crm.documents_bkup_copy` DFR
    INNER JOIN `dde-demo-d001.sap_crm.transactions_bkup` ICT
    ON DFR.transaction_header_guid = ICT.transaction_header_guid
    WHERE DFR.case_guid IS NULL
    AND trg.transaction_header_guid=ICT.transaction_header_guid;

using innerjoin there are two joins

using subquery

Reasons:
  • Blacklisted phrase (1): please check this
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @samhita
  • User mentioned (0): @PUTHINEEDI
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Jaango Jayaraj