Column Name as a Paramater

Viewed 14

I have a hive table and I would like to query the table for different column values in different situations. The query is-

select 
person_first_name,
person_last_name,
AVG(person_age), 
'column_variable' 
from 
person_details
group by 
person_first_name,
person_last_name,
'column_variable' 

Here, in the column_variable - sometimes I will have to pass city or state or zipcode column names. But in this mentioned way, the query is not working. Any suggestions please how I can pass the column names as a variable to this query?

0 Answers
Related