Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

compare subqueries oracle

// use NOT EXISTD (A MINUS B) instead of =

SELECT DISTINCT H1.HE_ID, H2.HE_ID
  FROM INV_HEAD H1, INV_HEAD H2
  WHERE H1.ID <> H2.ID
  AND NOT EXISTS(
    ((SELECT ART_ID, QUANTITY, PRICE FROM INV_POS WHERE HE_ID = H1.ID) 
      MINUS 
     (SELECT ART_ID, QUANTITY, PRICE FROM INV_POS WHERE HE_ID = H2.ID)) 
      UNION 
    ((SELECT ART_ID, QUANTITY, PRICE FROM INV_POS WHERE HE_ID = H2.ID) 
     MINUS 
     (SELECT ART_ID, QUANTITY, PRICE FROM INV_POS WHERE HE_ID = H1.ID)));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #compare #subqueries #oracle
ADD COMMENT
Topic
Name
1+2 =