pgSql, mySql中字符串转化为数字
pgSql
语法 to_number(text, text)
例子 select to_number(trim(both 'ibs' from classname), '999999') as cn from bbs order by cn /*trim(both 'ibs' from classname)去除classname字段中的'ibs'字符*/
mySql
语法 str*1 / str+1 / -str /*str为varchar的数字,此处不一定是1,只要是数字即可*/
hql
语法 to_number(text, text)
例子 select b from BBS b where b.isDeleted=false order by to_number(trim(both 'ibs' from b.className), '999999')
posted on 2012-06-14 15:43 timelyxyz 阅读(2701) 评论(0) 编辑 收藏 举报
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步