小编Bee*_*eeb的帖子

如何在 postgresql 中执行 =ANY(SELECT...query?

我正在尝试根据一组用户的 id 在另一个表中存储的数组中选择他们的所有纬度和经度。这是我的尝试:

SELECT latitude, longitude 
FROM userloc WHERE id = ANY( SELECT interested FROM donedeals WHERE deals_id=67);
Run Code Online (Sandbox Code Playgroud)

但它给了我以下错误:

ERROR:  operator does not exist: integer = integer[]
LINE 1: SELECT latitude, longitude FROM userloc WHERE id = ANY( SELE...
                                                         ^
HINT:  No operator matches the given name and argument type(s).
       You might need to add explicit type casts.
Run Code Online (Sandbox Code Playgroud)

donedeals有一int列 fordeals_id和一int array列 for interested,其中包含与 的 id 列对应的 id userloc,该列存储纬度和经度:

 deals_id |  interested …
Run Code Online (Sandbox Code Playgroud)

postgresql array

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

array ×1

postgresql ×1