This is based on the entry below by Eddy Vlad, replacing the "Like" query syntax with RLIKE to prevent invalid return results from occurring.

Example: consider two slave products with different masters assigned, 123 for one, and 124 for the other.
if we tried to use the old code looking for a master product with id = 12, it would have matched both!
new updated code uses a tighter regular expression to prevent this from happening ( products_master RLIKE '[[::]]' )

More...