Syntax To Extract An Array of One Field Value From a Database Query

I have a database query invoices which returns lots of fields - id, activity_id, description etc:

id    activity_id   description
==================================
123       456        description1
321       654        description2
...

I want to use an array of activity_id as the input to an IN clause in another query.
For this to work I need to return an array, not a comma separated list.

So for the example above, the array contains 456 and 654.

What syntax do I use to create the array?

Community Page
Last updated: