0

I'm trying to store results of a query into a variable. But I have the following error.

subquery returns more than 1 row

This is the code that I used:

set @var := (select country from (SELECT country FROM employeeTABLE 
order by rand() limit 250)t where country='USA');

The Query randomly selects 250 countries and then return country=USA among the 250 randomly selected countries. I want to store these USA in a variable. Suppose there are 3 country=USA in the 250 randomly selected countries. So I expect to have:

USA
USA
USA
user10316146
  • 115
  • 1
  • 6

0 Answers0