<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Query To Return Result Only If Data Exists in Multiple Tables Specific Partition in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Query-To-Return-Result-Only-If-Data-Exists-in-Multiple/m-p/387782#M246427</link>
    <description>&lt;P&gt;Given 6 tables with identical column and all partitioned by date&lt;/P&gt;&lt;P&gt;Need to get result of a union results from all 6 tables&lt;/P&gt;&lt;P&gt;only if all tables have data for the given date i.e. partition&lt;/P&gt;&lt;P&gt;else return nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 11 May 2024 10:35:22 GMT</pubDate>
    <dc:creator>ChineduLB</dc:creator>
    <dc:date>2024-05-11T10:35:22Z</dc:date>
    <item>
      <title>Query To Return Result Only If Data Exists in Multiple Tables Specific Partition</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Query-To-Return-Result-Only-If-Data-Exists-in-Multiple/m-p/387782#M246427</link>
      <description>&lt;P&gt;Given 6 tables with identical column and all partitioned by date&lt;/P&gt;&lt;P&gt;Need to get result of a union results from all 6 tables&lt;/P&gt;&lt;P&gt;only if all tables have data for the given date i.e. partition&lt;/P&gt;&lt;P&gt;else return nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2024 10:35:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Query-To-Return-Result-Only-If-Data-Exists-in-Multiple/m-p/387782#M246427</guid>
      <dc:creator>ChineduLB</dc:creator>
      <dc:date>2024-05-11T10:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: Query To Return Result Only If Data Exists in Multiple Tables Specific Partition</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Query-To-Return-Result-Only-If-Data-Exists-in-Multiple/m-p/387790#M246432</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/32170"&gt;@ChineduLB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WITH data_counts AS (&lt;BR /&gt;SELECT&lt;BR /&gt;COUNT(*) AS count_table1,&lt;BR /&gt;COUNT(*) AS count_table2,&lt;BR /&gt;COUNT(*) AS count_table3,&lt;BR /&gt;COUNT(*) AS count_table4,&lt;BR /&gt;COUNT(*) AS count_table5,&lt;BR /&gt;COUNT(*) AS count_table6&lt;BR /&gt;FROM&lt;BR /&gt;table1&lt;BR /&gt;WHERE&lt;BR /&gt;date_partition = 'your_date' -- Replace 'your_date' with the specific date you're interested in&lt;BR /&gt;UNION ALL&lt;BR /&gt;SELECT&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*)&lt;BR /&gt;FROM&lt;BR /&gt;table2&lt;BR /&gt;WHERE&lt;BR /&gt;date_partition = 'your_date'&lt;BR /&gt;UNION ALL&lt;BR /&gt;SELECT&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*)&lt;BR /&gt;FROM&lt;BR /&gt;table3&lt;BR /&gt;WHERE&lt;BR /&gt;date_partition = 'your_date'&lt;BR /&gt;UNION ALL&lt;BR /&gt;SELECT&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*)&lt;BR /&gt;FROM&lt;BR /&gt;table4&lt;BR /&gt;WHERE&lt;BR /&gt;date_partition = 'your_date'&lt;BR /&gt;UNION ALL&lt;BR /&gt;SELECT&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*)&lt;BR /&gt;FROM&lt;BR /&gt;table5&lt;BR /&gt;WHERE&lt;BR /&gt;date_partition = 'your_date'&lt;BR /&gt;UNION ALL&lt;BR /&gt;SELECT&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*),&lt;BR /&gt;COUNT(*)&lt;BR /&gt;FROM&lt;BR /&gt;table6&lt;BR /&gt;WHERE&lt;BR /&gt;date_partition = 'your_date'&lt;BR /&gt;)&lt;BR /&gt;SELECT&lt;BR /&gt;CASE&lt;BR /&gt;WHEN SUM(count_table1) &amp;gt; 0 AND SUM(count_table2) &amp;gt; 0 AND SUM(count_table3) &amp;gt; 0&lt;BR /&gt;AND SUM(count_table4) &amp;gt; 0 AND SUM(count_table5) &amp;gt; 0 AND SUM(count_table6) &amp;gt; 0 THEN&lt;BR /&gt;(SELECT * FROM table1 WHERE date_partition = 'your_date')&lt;BR /&gt;ELSE NULL -- or whatever you want to return if data doesn't exist in all tables&lt;BR /&gt;END AS result&lt;BR /&gt;FROM&lt;BR /&gt;data_counts;&lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2024 08:41:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Query-To-Return-Result-Only-If-Data-Exists-in-Multiple/m-p/387790#M246432</guid>
      <dc:creator>RAGHUY</dc:creator>
      <dc:date>2024-05-12T08:41:47Z</dc:date>
    </item>
  </channel>
</rss>

