Reputation: 79
Date is a reserved word in hive, but I have a table with column name 'date'. Every time I do "select date from mytable", it gives me an error.
Is there any way to query this column?
Upvotes: 8
Views: 10375
Reputation: 71
(backward apostrophe)date
(backward apostrophe) - works well
SELECT HD1.holidaydate as holiday_date, HD1.hub_id as holiday_hub_id, to_date(HD2.`date`), HD2.dateno as holiday_dateno
FROM table1 HD1 LEFT OUTER JOIN table2 HD2 ON HD1.holidaydate = to_date(HD2.`date`)
Upvotes: 7
Reputation: 79
I used "date" or 'date' -one or the other, and it worked. I just need to put the reserved word between quotes '' Example...
Select 'date' from mytable;
:)
Upvotes: -1