用ASCII解決
CREATE TABLE db
(`text` varchar(8))
;
INSERT INTO db
(`text`)
VALUES
('žybřidcz'),
('zybridcz')
;
select * from db where ASCII(text)= ASCII('zybridcz')
| text |
|----------|
| zybridcz |
感谢回复,刚试着用ASCII,
但是这样会跑出这样的结果来
zybridcz
zj9o4j6w
zyj0y9knt
zwe0gcny
zy11111
问题解决了,感谢帮助,我在后面加上,就可以了
select * from db where ASCII(text)= ASCII('zybridcz')
and text= 'zybridcz'
抱歉..刚发现如果是这样tuấn,tuan就不行了
会连同2个一起跑出来
抱歉..刚发现如果是这样tuấn,tuan就不行了
会连同2个一起跑出来
ASCII不行改用HEX
效能會差點
select * from db where HEX(text)= HEX('zybridcz')
嗯@@~我拿你的語法來~
我問你~如果改用INSTR效能如何呢?
因為我不知道~怎麼看出效能差別..
CREATE TABLE db
(`text` varchar(8))
;
INSERT INTO db
(`text`)
VALUES
('tuấn'),
('tuan'),
('žybřidcz'),
('zybridcz')
;
select *,ASCII(text),HEX(text)
from db
where INSTR(text,'tuan') > 0
使用Postgresql 輕鬆愉快
create table ithelp180617a (
id serial primary key
, val text not null
);
insert into ithelp180617a (val) values
('žybřidcz'), ('zybridcz');
select distinct val
from ithelp180617a;
val
----------
žybřidcz
zybridcz
(2 筆資料列)
select val, count(*)
from ithelp180617a
group by val;
val | count
----------+-------
žybřidcz | 1
zybridcz | 1
(2 筆資料列)
select *
from ithelp180617a
where val = 'žybřidcz';
id | val
----+----------
1 | žybřidcz
(1 筆資料列)