I am finding number of days in a month as below.
set ndays=datediff(CONCAT(y, '-', (m + 1), '-', '01'), CONCAT(y, '-', m, '-', '01')) FROM (SELECT month(current_date) as m, year(current_date) as y, day(current_date)) tabl1;
I am checking the value.
select ${hiveconf:ndays}; --O/P 31
I am using this variable in a query and getting error.
select
sum(price)/ ${hiveconf:ndays}
from sales_aly
GROUP BY sales_month;
FAILED: ParseException line 3:0 missing EOF at 'from' near 'tabl1'
Please help me.
Thanks in Advance.