I have a table called "scholarships" that has a field named "majors" which contains comma separated major names for the majors the scholarship is related too.
Let's say the field could contain one (or more separated by commas) of the following: business, agribusiness, business administration, international business.
If someone is searching "business" as the major, how can I select "business" as a match but not the others?
The closest I've come is this but I know it could be better - my regex ability isn't so hot.
SELECT scholarship_id, scholarship_award_name, scholarship_majors
FROM scholarships
WHERE scholarship_majors rlike '[, ][[:<:]]business[[:>:]][, ]'
OR scholarship_majors rlike '^[[:<:]]business[[:>:]][, ]'
OR scholarship_majors rlike '[, ][[:<:]]business[[:>:]]$'
I'm trying to catch the field if it begins with "business" or ", business" or "business ", "business, " but not "business administration" etc...
Any advice?