Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

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

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>)


Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.