storing query results in a variable in mysql and using it in another query
The post you link to only discusses capturing a single scalar value into the variable, not an entire result set.  

You are trying to capture more than one column and presumably more than one row.  MySQL variables can only hold one scalar value.

It seems like what you are looking for is a temporary table, but on the other hand, your explanation is difficult to understand... why would you group by state when the source data is grouped by state?  And what do you mean by the union of the above "two" qieries?  The result of the last query should be identical to the one before it, if such  construct were possible.