※ 引述《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