title: How to pass Table columns values to an Array or String
body: <p>I Have table1 with the columns: ID,Fname,Lname .
  Using Sql query i select the shown values</p>
  
  <p><a href="https://i.stack.imgur.com/HiK1Z.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HiK1Z.jpg" alt="enter image description here"></a></p>
  
  <p>what i wan't to do is to pass the column ID values to an Array like that: </p>
  
  <blockquote>
    <p>MyArray[1,2,5]</p>
  </blockquote>
  
  <p>or as string but it shoul be like : </p>
  
  <blockquote>
    <p>1,2,3</p>
  </blockquote>
  
  <p>So i can use them in PosgtreSQL query like:</p>
  
  <blockquote>
    <p>SELECT * FROM table2 WHERE ID = ANY(ARRAY[1,2,5])</p>
  </blockquote>
  
  <p>the length of the array or the string depends on the selected values in the first table</p>