我有一个名为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'
的记录。
如何防止这种情况?
答案 0 :(得分:1)
尝试使用BINARY
select * from member where BINARY id = '1 3';