Skip to content
Advertisement

us WHERE statement and ARRAY for AthenaQuery

I have an SQL query like this (written for PostgreSQL):

SELECT *
FROM users
WHERE users.company_id = ANY(ARRAY[945387, 969109, 1460013, 1460044]) AND
 users.profession_id = ANY(ARRAY[2738, 6388]) 
GROUP BY users.company_id

but I can’t run it like this for AthenaQuery (getting SYNTAX_ERROR: Function any not registered). How can I convert it?

Advertisement

Answer

You can rewrite the array operator to a standard IN condition.

Your query is equivalent to:

SELECT *
FROM users
WHERE users.company_id IN (945387, 969109, 1460013, 1460044) 
  AND users.profession_id IN (2738, 6388)
GROUP BY users.company_id
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement