Sql 在select查询中拆分postgres中的列

Sql 在select查询中拆分postgres中的列,sql,postgresql,Sql,Postgresql,我有一个列,其中有多个带逗号分隔的员工id。需要使用select查询检索该员工id列的where条件的数据,但每次需要传递一个id。在下面的“员工id”列中,有多个id SELECT lt.* FROM leave as lt WHERE true and employee_id IN ($employee_id) 那么,试试这样的方法: SELECT * FROM ... WHERE id = ANY (string_to_array(ids, ',')::integer[])

我有一个列,其中有多个带逗号分隔的员工id。需要使用select查询检索该员工id列的where条件的数据,但每次需要传递一个id。在下面的“员工id”列中,有多个id

SELECT lt.*  
FROM leave as lt 
WHERE true 
  and employee_id IN ($employee_id)

那么,试试这样的方法:

SELECT * FROM ... WHERE id = ANY (string_to_array(ids,  ',')::integer[])

$employee\u id
也有逗号分隔的数据,还是只有一个id?