如何在 postgreSQL 中将 select 子句中的数字列表转换为 int ?
我在存储过程中有一条 sql 语句:
SELECT DISTINCT code,SOURCE, subtype_id FROM alarm_management.alarm_attribute WHERE id in (SELECT alarm_attribute FROM amisha_alarm_management.alarm_query WHERE id = '1'))
此子查询以字符串格式返回数字,即
'{4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}'
由于此原因,我收到错误:错误:运算符不存在:integer =smallint[]。如何修改查询以便子查询只返回像这样的数字
4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
I have a sql statement in stored procedure:
SELECT DISTINCT code,SOURCE, subtype_id FROM alarm_management.alarm_attribute WHERE id in (SELECT alarm_attribute FROM amisha_alarm_management.alarm_query WHERE id = '1'))
This subquery is returning numbers in string format i.e.
'{4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}'
Due to this I am getting an error that ERROR: operator does not exist: integer = smallint[].How can I modify the query so that the subquery returns only numbers like
4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论