我的搜索查询有问题。我正在搜索电子邮件。
我有这样的搜索查询:
$query = sprintf("SELECT mailer_subscribers.id, mailer_subscribers.email, mailer_subscribers.status,mailer_segmentlinker.segment_id, mailer_segmenten.segmentnaam FROM mailer_subscribers
JOIN mailer_segmentlinker ON mailer_subscribers.id=mailer_segmentlinker.subscriber_id
JOIN mailer_segmenten ON mailer_segmentlinker.segment_id=mailer_segmenten.id
WHERE MATCH (email) AGAINST ('%s*' IN BOOLEAN MODE)", $key);
但是当我在示例“ john.smith
”中输入关键字时,它会返回所有具有相同名称或姓氏的值
john.smith@example.com
john.notsmith@example.com
smith.hendrix@example.com
josh.josh@smith.com
我需要它会给我一个列表john.smith
。
编辑:
对我有帮助的解决方案是:
WHERE mailer_subscribers.email LIKE '%%%s%%'", $key);