diz*_*iaq 4 arrays postgresql where-in
我正在尝试简化以下 SQL 语句(为了清晰起见,将其包装到函数中)。
使用array内部where ... in (/*array*/)子句的更简单/自然的语法方式是什么?(没有select * from unnest(...)样板)
CREATE OR REPLACE FUNCTION get_items(p_ids int[])
RETURNS SETOF text
LANGUAGE sql
AS $$
select t.name
from my_table t
where f.id in (select * from unnest(p_ids))
$$;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5733 次 |
| 最近记录: |