MySQL: Optimizing Searches with LIKE or FULLTEXT
问题 I am building a forum and I am looking for the proper way to build a search feature that finds users by their name or by the title of their posts. What I have come up with is this: SELECT users.id, users.user_name, users.user_picture FROM users, subject1, subject2 WHERE users.id = subject1.user_id AND users.id = subject2.user_id AND (users.user_name LIKE '%{$keywords}%' OR subject1.title1 LIKE '%{$keywords}%' OR subject2.title2 LIKE '%{$keywords}%') ORDER BY users.user_name ASC LIMIT 10