MySQL自动将空格分割为空格

loading...


0

我有一张名为 members 的下表

+----+--------+--------+-------+--+
| id | name   | gender | state |  |
+----+--------+--------+-------+--+
| 1  | Peter  | M      | 1     |  |
+----+--------+--------+-------+--+
| 2  | Sally  | F      | 1     |  |
+----+--------+--------+-------+--+
| 3  | Martin | M      | 0     |  |
+----+--------+--------+-------+--+

然后,我的查询是

SELECT * FROM `member` WHERE `id` = '1 3';

MySQL返回 | 1 | Peter | M | 1 | | .

但是,我希望它不会返回任何内容,因为 id = '1 3' 应该没有记录 .

我怎么能阻止这个?

loading...

1回答

  • 1

    尝试使用 BINARY

    select * from member where BINARY id = '1 3';
    
评论

暂时没有评论!