<?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 NOT IN operator in hive with a subquery in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NOT-IN-operator-in-hive-with-a-subquery/m-p/117104#M34081</link>
    <description>&lt;P&gt;I have a subquery like this:&lt;/P&gt;&lt;PRE&gt;select SF.customer_email , SF.created_at
FROM 
Table1 SF
WHERE
YEAR(TO_DATE(SF.created_at)) = '2016'
AND 
MONTH(TO_DATE(SF.created_at)) = '6'
AND 
SF.customer_email 
NOT IN (
select SFO.customer_email FROM Table1 SFO 
WHERE
TO_DATE(SFO.created_at) &amp;lt; '2016-05-31'
)&lt;/PRE&gt;&lt;P&gt;I have checked manually and I should get results for the query but it returns empty resultset.&lt;/P&gt;&lt;P&gt;Note: I am using same table in the subquery as well. Just a different condition on date column.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2016 14:22:43 GMT</pubDate>
    <dc:creator>simran_k</dc:creator>
    <dc:date>2016-07-07T14:22:43Z</dc:date>
    <item>
      <title>NOT IN operator in hive with a subquery</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NOT-IN-operator-in-hive-with-a-subquery/m-p/117104#M34081</link>
      <description>&lt;P&gt;I have a subquery like this:&lt;/P&gt;&lt;PRE&gt;select SF.customer_email , SF.created_at
FROM 
Table1 SF
WHERE
YEAR(TO_DATE(SF.created_at)) = '2016'
AND 
MONTH(TO_DATE(SF.created_at)) = '6'
AND 
SF.customer_email 
NOT IN (
select SFO.customer_email FROM Table1 SFO 
WHERE
TO_DATE(SFO.created_at) &amp;lt; '2016-05-31'
)&lt;/PRE&gt;&lt;P&gt;I have checked manually and I should get results for the query but it returns empty resultset.&lt;/P&gt;&lt;P&gt;Note: I am using same table in the subquery as well. Just a different condition on date column.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 14:22:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NOT-IN-operator-in-hive-with-a-subquery/m-p/117104#M34081</guid>
      <dc:creator>simran_k</dc:creator>
      <dc:date>2016-07-07T14:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: NOT IN operator in hive with a subquery</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NOT-IN-operator-in-hive-with-a-subquery/m-p/117105#M34082</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/10486/simrank.html" nodeid="10486"&gt;@Simran Kaur&lt;/A&gt;.  This query 'should' work.  &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; Quick things to double-check...&lt;/P&gt;&lt;P&gt;1.  These 2 queries return counts &amp;gt; 0 &lt;/P&gt;&lt;PRE&gt;select count(*) 
FROM Table1 SF 
WHERE YEAR(TO_DATE(SF.created_at)) = '2016'
AND   MONTH(TO_DATE(SF.created_at)) = '6'&lt;/PRE&gt;&lt;PRE&gt;select count(*) FROM Table1 SFO 
WHERE TO_DATE(SFO.created_at) &amp;lt; '2016-05-31'&lt;/PRE&gt;&lt;P&gt;2. based on the counts returned - is it possible that there are no customers from June 2016 that did not receive an email prior to 2016 June? (i.e. the correct result is in fact zero)? &lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 20:39:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NOT-IN-operator-in-hive-with-a-subquery/m-p/117105#M34082</guid>
      <dc:creator>bpreachuk</dc:creator>
      <dc:date>2016-07-07T20:39:06Z</dc:date>
    </item>
  </channel>
</rss>

