Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
考虑以下查询
INSERT INTO DummyTable (TextColumn) VALUES ('Text'); INSERT INTO DummyTable (TextColumn) VALUES ('Text '); SELECT DISTINCT TextColumn FROM DummyTable
请注意,第二个插入包含一个空格:'Text'
但是 DISTINCT 会忽略空格并只返回一行“文本” - 你如何让 DISTINCT 不忽略空格?
原来我正在寻找一个 BINARY 关键字,然后 DISTINCT 比较原始二进制值,包括空格。
SELECT DISTINCT BINARY TextColumn FROM DummyTable
SELECT DISTINCT replace(TextColumn,' ','') FROM DummyTable