<?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 hive query to check for entries added in a particular month that do not exist already in the database in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-query-to-check-for-entries-added-in-a-particular-month/m-p/117526#M34092</link>
    <description>&lt;P&gt;I need to check for new emailId's added in 06-2016 that have not existed in database ever before that. &lt;/P&gt;&lt;P&gt;I wrote the query using NOT IN operator:&lt;/P&gt;&lt;PRE&gt;select DISTINCT SF.customer_email
FROM 
Magento.sales_flat_order 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 Magento.Sales_flat_order SFO 
WHERE
TO_DATE(SFO.created_at) &amp;lt;= '2016-05-31'
)&lt;/PRE&gt;&lt;P&gt;I have verified that there are new emaiid's in the time but it returns empty result-set. Why is that? Infact, When I replace NOT IN operator with IN operator, it does return me the common ones but somehow NOT IN is behaving erratically.&lt;/P&gt;&lt;P&gt;Is there an alternative way I can do it?&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2016 17:03:58 GMT</pubDate>
    <dc:creator>simran_k</dc:creator>
    <dc:date>2016-07-07T17:03:58Z</dc:date>
    <item>
      <title>hive query to check for entries added in a particular month that do not exist already in the database</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-query-to-check-for-entries-added-in-a-particular-month/m-p/117526#M34092</link>
      <description>&lt;P&gt;I need to check for new emailId's added in 06-2016 that have not existed in database ever before that. &lt;/P&gt;&lt;P&gt;I wrote the query using NOT IN operator:&lt;/P&gt;&lt;PRE&gt;select DISTINCT SF.customer_email
FROM 
Magento.sales_flat_order 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 Magento.Sales_flat_order SFO 
WHERE
TO_DATE(SFO.created_at) &amp;lt;= '2016-05-31'
)&lt;/PRE&gt;&lt;P&gt;I have verified that there are new emaiid's in the time but it returns empty result-set. Why is that? Infact, When I replace NOT IN operator with IN operator, it does return me the common ones but somehow NOT IN is behaving erratically.&lt;/P&gt;&lt;P&gt;Is there an alternative way I can do it?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 17:03:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-query-to-check-for-entries-added-in-a-particular-month/m-p/117526#M34092</guid>
      <dc:creator>simran_k</dc:creator>
      <dc:date>2016-07-07T17:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: hive query to check for entries added in a particular month that do not exist already in the database</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-query-to-check-for-entries-added-in-a-particular-month/m-p/117527#M34093</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;.  I added an answer to your other version of this question found here (https://community.hortonworks.com/questions/43885/not-in-operator-in-hive-with-a-subquery.html#answer-43944) &lt;/P&gt;&lt;P&gt;One other thing I like to look for is leading or trailing blanks in the comparison field (email address).  But in this instance it should not cause a problem since you are using the same table (and the same email addresses) in the inner and outer query.     &lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 20:45:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-query-to-check-for-entries-added-in-a-particular-month/m-p/117527#M34093</guid>
      <dc:creator>bpreachuk</dc:creator>
      <dc:date>2016-07-07T20:45:14Z</dc:date>
    </item>
  </channel>
</rss>

