<?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 Re: Datediff in HIVE with SQL support in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Datediff-in-HIVE-with-SQL-support/m-p/209431#M62877</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;the problem is that your query is syntactically wrong. The right query to achieve your goal is:&lt;/P&gt;&lt;PRE&gt;select memberid, max(insertdtm) from finaldata group by memberid having datediff(current_date, max(insertdtm))&amp;gt;30;
&lt;/PRE&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jun 2017 22:38:41 GMT</pubDate>
    <dc:creator>mgaido1</dc:creator>
    <dc:date>2017-06-14T22:38:41Z</dc:date>
    <item>
      <title>Datediff in HIVE with SQL support</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Datediff-in-HIVE-with-SQL-support/m-p/209430#M62876</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have table in HIVE with insertDTM and id. My job is to find out those 
member whose last insertDTM is 30 days older than the present date. I am
 using Datediff UFD for that. My query is something like ..&lt;/P&gt;&lt;PRE&gt;select * from finaldata where datediff(current_date,select max(insertdtm) from finaldata group by memberid)&amp;gt;30;&lt;/PRE&gt;&lt;P&gt;But it is giving some error. Its looks like datediff does not support any SQL as param. &lt;/P&gt;&lt;P&gt;One more thing , can any one explain why this is not working ? when I
 am calling datediff with SQL , how HIVE handle this ? My assumption was
 that first it will execute the SQL in between (in my case which is 
"select max(insertdtm) from finaldata group by memberid") then call the 
Datediff with current_date and the output of this SQL. But it looks like
 it is not working that way. &lt;/P&gt;&lt;P&gt;Thanks a lot ...&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 17:51:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Datediff-in-HIVE-with-SQL-support/m-p/209430#M62876</guid>
      <dc:creator>Biswajit16</dc:creator>
      <dc:date>2017-06-14T17:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Datediff in HIVE with SQL support</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Datediff-in-HIVE-with-SQL-support/m-p/209431#M62877</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;the problem is that your query is syntactically wrong. The right query to achieve your goal is:&lt;/P&gt;&lt;PRE&gt;select memberid, max(insertdtm) from finaldata group by memberid having datediff(current_date, max(insertdtm))&amp;gt;30;
&lt;/PRE&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 22:38:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Datediff-in-HIVE-with-SQL-support/m-p/209431#M62877</guid>
      <dc:creator>mgaido1</dc:creator>
      <dc:date>2017-06-14T22:38:41Z</dc:date>
    </item>
  </channel>
</rss>

