"Column name 'identifier' specified more than once" in AWS Athena

Viewed 21

When I try to create a view from a query in AWS Athena, I get error messages like "Column name 'identifier' specified more than once." How do I specify that table1.identifier is different from table3.identifier?

This query will run but gives an error when I try to create a view from it:

SELECT 
table1.name, 
table1.identifier, 
table2.question_instructions, 
table2.value, 
table3.identifier, 
table2.date         

FROM "table1"

JOIN table4 ON table1.id = table4.instrument_id
JOIN table2 ON table4.id = table2.question_id
JOIN table3 ON table2.user_id = table3.user_id

WHERE question_id = 'b194424f7fdd41ae9';
1 Answers

You need to give them different names. For example:

SELECT 
table1.name, 
table1.identifier, 
table2.question_instructions, 
table2.value, 
table3.identifier table3_identifier_alias, -- or use any other appropriate
table2.date         
Related