I'm passing max(pay_date)
to a variable Max_date
in Shell from Hive table.
The datatype of pay_date
field is Date
.
I want to extract 7 days of pay_date
from Max_date
of pay_date
from the table.
I used below script to get...
#!/bin/bash
Max_date=$(hive -e "select max(pay_date) from dbname.tablename;")
hive -e "select pay_date from dbname.tablename where pay_date >= date_sub(\"$Max_date\",7);"
It's not giving me any output.
I'm stuck with passing a variable which has date value and use that in date_sub function for last 7 days of rows.
Please let me know if I'm missing some absolute basics.