{"id":8269,"date":"2022-09-12T18:06:18","date_gmt":"2022-09-12T12:36:18","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/"},"modified":"2022-09-12T18:06:18","modified_gmt":"2022-09-12T12:36:18","slug":"solved-fetching-unmatching-rejected-rows","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/","title":{"rendered":"[Solved] Fetching Unmatching\/Rejected rows"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-33435525\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"33435525\" data-parentid=\"33429691\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>It appears that you want to do something like<\/p>\n<pre><code>select *\n  from Tab1\n  LEFT OUTER join Tab2\n    on Tab1.col1=Tab2.col1 and\n       Tab1.col2=Tab2.col3 and\n       Tab1.col4=Tab2.col5 AND\n       Tab2.col3=&lt;value&gt;\n  LEFT OUTER join Tab3\n    ON (TAB3.SOMETHING = TAB1.SOMETHING OR\n        TAB3.SOMETHING_ELSE = TAB2.SOMETHING_ELSE) AND\n       Tab3.col2=&lt;value&gt; and\n  WHERE Tab1.col3=&lt;value&gt; and\n        Tab1.col4=&lt;value&gt; AND\n        TAB2.PRIMARY_KEY IS NULL AND\n        TAB3.PRIMARY_KEY IS NULL;\n<\/code><\/pre>\n<p>Note the use of outer joins. A LEFT OUTER JOIN means that data must be present in the left table (e.g. TAB1 in the join between TAB1 and TAB2), but optionally may not exist in the right table. Contrast this with<\/p>\n<ol>\n<li>an INNER JOIN where matching data must exist in both tables for the result to be included in the result set,<\/li>\n<li>a RIGHT OUTER JOIN, where data must exist in the right-most table but optionally may not exist in the left table, and<\/li>\n<li>a FULL OUTER JOIN where data must exist in one of the two tables but may not have matching data in the other table. (A full outer join can be thought of as a left and a right outer join simultaneously).<\/li>\n<\/ol>\n<p>The WHERE clause checks for TAB2.PRIMARY_KEY and TAB3.PRIMARY_KEY being NULL. By definition a primary key must be non-NULL, so the fact the the PK column is NULL in the joined data means that no matching row was found in the joined table.<\/p>\n<p>Your example query suffers from the problem that there&#8217;s no condition given for joining TAB3 to either TAB1 or TAB2. Although you could do this, it would mean that every row from the join of TAB1 and TAB2 would be joined to every row from TAB3 where TAB3.COL2 = . So if the join of TAB1 and TAB2 emitted 1000 rows, and TAB3 contained 1000 rows, your result table would end up with 1000 * 1000 = 1,000,000 rows &#8211; probably not what was intended. I added a join condition just to keep things reasonable.<\/p>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">1<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved Fetching Unmatching\/Rejected rows <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] It appears that you want to do something like select * from Tab1 LEFT OUTER join Tab2 on Tab1.col1=Tab2.col1 and Tab1.col2=Tab2.col3 and Tab1.col4=Tab2.col5 AND Tab2.col3=&lt;value&gt; LEFT OUTER join Tab3 ON (TAB3.SOMETHING = TAB1.SOMETHING OR TAB3.SOMETHING_ELSE = TAB2.SOMETHING_ELSE) AND Tab3.col2=&lt;value&gt; and WHERE Tab1.col3=&lt;value&gt; and Tab1.col4=&lt;value&gt; AND TAB2.PRIMARY_KEY IS NULL AND TAB3.PRIMARY_KEY IS NULL; Note the &#8230; <a title=\"[Solved] Fetching Unmatching\/Rejected rows\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/\" aria-label=\"More on [Solved] Fetching Unmatching\/Rejected rows\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[838,341],"class_list":["post-8269","post","type-post","status-publish","format-standard","hentry","category-solved","tag-oracle","tag-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[Solved] Fetching Unmatching\/Rejected rows - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] Fetching Unmatching\/Rejected rows - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] It appears that you want to do something like select * from Tab1 LEFT OUTER join Tab2 on Tab1.col1=Tab2.col1 and Tab1.col2=Tab2.col3 and Tab1.col4=Tab2.col5 AND Tab2.col3=&lt;value&gt; LEFT OUTER join Tab3 ON (TAB3.SOMETHING = TAB1.SOMETHING OR TAB3.SOMETHING_ELSE = TAB2.SOMETHING_ELSE) AND Tab3.col2=&lt;value&gt; and WHERE Tab1.col3=&lt;value&gt; and Tab1.col4=&lt;value&gt; AND TAB2.PRIMARY_KEY IS NULL AND TAB3.PRIMARY_KEY IS NULL; Note the ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-12T12:36:18+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-fetching-unmatching-rejected-rows\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-fetching-unmatching-rejected-rows\\\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] Fetching Unmatching\\\/Rejected rows\",\"datePublished\":\"2022-09-12T12:36:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-fetching-unmatching-rejected-rows\\\/\"},\"wordCount\":281,\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"keywords\":[\"oracle\",\"sql\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-fetching-unmatching-rejected-rows\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-fetching-unmatching-rejected-rows\\\/\",\"name\":\"[Solved] Fetching Unmatching\\\/Rejected rows - JassWeb\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\"},\"datePublished\":\"2022-09-12T12:36:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-fetching-unmatching-rejected-rows\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-fetching-unmatching-rejected-rows\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-fetching-unmatching-rejected-rows\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] Fetching Unmatching\\\/Rejected rows\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\\\/\\\/jassweb.com\"],\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/author\\\/jaspritsinghghumangmail-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] Fetching Unmatching\/Rejected rows - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] Fetching Unmatching\/Rejected rows - JassWeb","og_description":"[ad_1] It appears that you want to do something like select * from Tab1 LEFT OUTER join Tab2 on Tab1.col1=Tab2.col1 and Tab1.col2=Tab2.col3 and Tab1.col4=Tab2.col5 AND Tab2.col3=&lt;value&gt; LEFT OUTER join Tab3 ON (TAB3.SOMETHING = TAB1.SOMETHING OR TAB3.SOMETHING_ELSE = TAB2.SOMETHING_ELSE) AND Tab3.col2=&lt;value&gt; and WHERE Tab1.col3=&lt;value&gt; and Tab1.col4=&lt;value&gt; AND TAB2.PRIMARY_KEY IS NULL AND TAB3.PRIMARY_KEY IS NULL; Note the ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/","og_site_name":"JassWeb","article_published_time":"2022-09-12T12:36:18+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] Fetching Unmatching\/Rejected rows","datePublished":"2022-09-12T12:36:18+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/"},"wordCount":281,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["oracle","sql"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/","url":"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/","name":"[Solved] Fetching Unmatching\/Rejected rows - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-09-12T12:36:18+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-fetching-unmatching-rejected-rows\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] Fetching Unmatching\/Rejected rows"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/8269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=8269"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/8269\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=8269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=8269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=8269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}