[mysql] Solution to "subquery returns more than 1 row" error