作者pakker (找寻蔚蓝天空)
看板Database
标题Re: [SQL ] 找出有底线的资料
时间Wed Oct 31 22:55:19 2007
※ 引述《statuette (statuette)》之铭言:
: 请问一下
: 我的资料里有底线(underline)
: 且有两条底线连在一起的..
: 我想下WHERE条件找出这种资料
: 有试过用跳脱字元
: WHERE COL LIKE '%\_\_%'
: 但是没有用
: 请问一下该怎麽下才会对呢?
: 谢谢!
MySQL:
mysql> select 'abc_def' like '%\_\_%';
+-------------------------+
| 'abc_def' like '%\_\_%' |
+-------------------------+
| 0 |
+-------------------------+
1 row in set (0.00 sec)
mysql> select 'abc__def' like '%\_\_%';
+--------------------------+
| 'abc__def' like '%\_\_%' |
+--------------------------+
| 1 |
+--------------------------+
1 row in set (0.00 sec)
PostgreSQL:
postgres=# select 'abc_def' like E'%\\_\\_%';
?column?
----------
f
(1 row)
postgres=# select 'abc__def' like E'%\\_\\_%';
?column?
----------
t
(1 row)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.121.20.45