Apologies for question title, if anyone can explain it better please do edit.
I have a MySQL select statement (which I am running through Perl dbi) like below:
select skills from my_table where (skills like '%maths%' or skills like '%english%');
This will run, but it chooses either skills like ‘maths’ OR skills like ‘english’.
I would like to have it so it definitely finds ‘maths’, and maybe finds ‘english’ if that makes sense.
I think of it kind of like when you have and, where it only returns results with those elements. So if I had done:
select skills from my_table where (skills like '%maths%' and skills like '%english%');
it would have returned results with BOTH skills.
So what I want is a combination of both sqls if that is possible, with the ‘maths’ being a definite find, and the ‘english’ being optional. I hope I have explained this properly… any help appreciated!
Edit: okay, maybe I do need to clarify… if there is an option for ‘english’ I want it to be found, but if there isn’t I want it to still pick up options for ‘maths’, but if there are no ‘maths’ options, then I want it to return nothing. So it is not just one or the other.
This will return the
keyFieldfor all rows with maths skills, as well as an additional column to show whether or not they also have english skills.