gpt4 book ai didi

postgresql - 从整数列中获取子字符串

转载 作者:行者123 更新时间:2023-11-29 11:53:20 25 4
gpt4 key购买 nike

我有一个快速的问题,我怎样才能对整数使用 SUBSTRING?我目前有一个标有“StoreID”的字段,其中包含一个 5 位整数 (60008)。当我查询此信息时,我正在尝试使用 SUBSTRING 删除 6。当我使用类似的东西时:

SUBSTRING('StoreID', 2, 6)我收到一个错误返回说 SUBSTRING(integer,integer,integer) 不存在。

我可以在 postgres 中使用另一个函数来完成我想做的事情吗?

最佳答案

你可以转换整数

SUBSTR(cast (StoreId as text), 2,6)

关于postgresql - 从整数列中获取子字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16652967/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com