日期:2014-05-16 浏览次数:20774 次
mysql> select * from tend; +----+----------------------+----------------------+----------------------+----------------------+----------------------+ | id | u1 | u2 | u3 | u4 | u5 | +----+----------------------+----------------------+----------------------+----------------------+----------------------+ | 1 | http://www.aaaa.com/ | http://www.bbbb.com/ | http://www.cccc.com/ | http://www.dddd.com/ | http://www.eeee.com/ | | 2 | http://www.ffff.com/ | http://www.gggg.com/ | http://www.hhhh.com/ | http://www.iiii.com/ | | | 3 | http://www.aa11.com/ | http://www.aa22.com/ | http://www.aa33.com/ | http://www.aa44.com/ | NULL | | 4 | http://www.xx11.com/ | http://www.xx22.com/ | http://www.xx33.com/ | NULL | NULL | | 5 | http://www.yy11.com/ | http://www.yy22.com/ | NULL | NULL | NULL | | 6 | http://www.zz11.com/ | http://www.zz22.com/ | http://www.zz33.com/ | NULL | NULL | +----+----------------------+----------------------+----------------------+----------------------+----------------------+ 6 rows in set (0.00 sec) mysql> select * from tend -> where find_in_set(u1,'http://www.gggg.com/,http://www.zz33.com/') -> or find_in_set(u2,'http://www.gggg.com/,http://www.zz33.com/') -> or find_in_set(u3,'http://www.gggg.com/,http://www.zz33.com/') -> or find_in_set(u4,'http://www.gggg.com/,http://www.zz33.com/') -> or find_in_set(u5,'http://www.gggg.com/,http://www.zz33.com/'); +----+----------------------+----------------------+----------------------+----------------------+------+ | id | u1 | u2 | u3 | u4 | u5 | +----+----------------------+----------------------+----------------------+----------------------+------+ | 2 | http://www.ffff.com/ | http://www.gggg.com/ | http://www.hhhh.com/ | http://www.iiii.com/ | | | 6 | http://www.zz11.com/ | http://www.zz22.com/ | http://www.zz33.com/ | NULL | NULL | +----+----------------------+----------------------+----------------------+----------------------+------+ 2 rows in set (0.00 sec) mysql>