Support Questions

Find answers, ask questions, and share your expertise

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

avatar
Rising Star

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

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