postgresql 中的一个类型转换

t240034137 2010-06-13 05:04:29

select * from netbardistrict_dimension where district_key like '%0';

ERROR: operator does not exist: integer ~~ unknown
LINE 1: ...* from netbardistrict_dimension where district_key like '%0'
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

********** 错误 **********

ERROR: operator does not exist: integer ~~ unknown
SQL 状态: 42883
指导建议:No operator matches the given name and argument type(s). You might need to add explicit type casts.
字符:59


district_key是INT型 但是我 如何把字符型转化为INT呢? 这个数据库语句 改怎么写?
...全文
261 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
xilaianzxsc 2010-06-16
  • 打赏
  • 举报
回复
用cast转换试试了。
ncowboy 2010-06-16
  • 打赏
  • 举报
回复
你想判断是不是整10倍?你试试除以10再乘以10,也许更快一些。
ncowboy 2010-06-16
  • 打赏
  • 举报
回复

testdb=# select CAST(100 as varchar) like '%0';
?column?
----------
t
(1 row)

testdb=#
jimzhke 2010-06-15
  • 打赏
  • 举报
回复
用cast转换试试了。
t240034137 2010-06-13
  • 打赏
  • 举报
回复
谢谢看看看
luoyoumou 2010-06-13
  • 打赏
  • 举报
回复
MySQL的类型转换convert\cast
文章出处:飞诺网(www.firnow.com):http://dev.firnow.com/course/7_databases/mysql/Mysqljs/20071120/87162.html
t240034137 2010-06-13
  • 打赏
  • 举报
回复
顶!帖子!

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧