1

I've got a rather simple query, I just need to check that a row's primary key is in an array of integers.

This is my current query:

SELECT * FROM entries WHERE id in [573240252177580032, 706271127542038608, 772980293929402389]

However, this yields the following error: 'syntax error near or at "["'

How can I do this?

1 Answer 1

1

You can use the ANY function for that:

demo:db<>fiddle

SELECT * 
FROM entries 
WHERE id = ANY(ARRAY[573240252177580032, 706271127542038608, 772980293929402389])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.