免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2970 | 回复: 8
打印 上一主题 下一主题

问一个SQL语句的问题。。。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-31 13:31 |只看该作者 |倒序浏览
现在有Table_A,其中有一段Rignts一串由0111100010组成的40位字符串

现在要选出Rights中第12位且第19位为1的数据。。

Select * from Table_A where substr(Rights,12,1)='1' and substr(Rights,19,1)='1'
貌似不行。。。'substr' is not a recognized built-in function name.

大侠们帮忙看看。。。谢谢

[ 本帖最后由 shinehom 于 2008-10-31 14:57 编辑 ]

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
2 [报告]
发表于 2008-10-31 13:45 |只看该作者
原帖由 shinehom 于 2008-10-31 13:31 发表
现在有Table_A,其中有一段Rignts一串由0111100010组成的40位字符串

现在要选出Rights中第12位和第19位为1的数据。。

Select * from Table_A where substr(Rights,12,1)='1' and substr(Rights,19,1)='1' ...


Select * from Table_A where substr(Rights,12,1)='1' or substr(Rights,19,1)='1'

论坛徽章:
0
3 [报告]
发表于 2008-10-31 14:58 |只看该作者
原帖由 snow888 于 2008-10-31 13:45 发表


Select * from Table_A where substr(Rights,12,1)='1' or substr(Rights,19,1)='1'



是整句无法运行。。。

不是与和或的问题。。。

论坛徽章:
0
4 [报告]
发表于 2008-11-01 09:08 |只看该作者
'substr' is not a recognized built-in function name.——substr不是内置函数。可能你的数据库对应的这个函数的名称不是substr,试试SUBSTRING(Rights,12,1)

论坛徽章:
0
5 [报告]
发表于 2008-11-01 09:54 |只看该作者
Select * from Table_A where substring(Rights,12,1)='1' and substring(Rights,19,1)='1'

论坛徽章:
0
6 [报告]
发表于 2008-11-01 12:02 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
7 [报告]
发表于 2008-11-01 13:32 |只看该作者
substring

论坛徽章:
0
8 [报告]
发表于 2008-11-02 21:00 |只看该作者
呵呵,substr是oracle的内嵌函数

论坛徽章:
0
9 [报告]
发表于 2008-11-03 10:58 |只看该作者
谢谢。。。那天问题已经解决了。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP