Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Hive query to find Total count of records and count(lastrundate) records

Highlighted

Hive query to find Total count of records and count(lastrundate) records

Explorer

Hi,


I need to get output like total-count-of-records-InTable, count(max(date)) using Hive.


Where count(max(date)) ----> gives the count of records loaded from last run. Each record has current-run-date column.


I know to get both separately, but not sure to get the output together...


Could anyone help me on this...


Appreciate your help..



Thanks,

Jee






1 REPLY 1

Re: Hive query to find Total count of records and count(lastrundate) records

Super Guru

@Jeeva Jeeva

Try with the below queries:

select count(*) from <db>.<tab_name> 
where date in (select max(date) from <db>.<tab_name> --get max date from table)

(or)

select count(*) from <db>.<tab_name> 
where date = (select max(date) from <db>.<tab_name>)