title: MySQL: Set user variable from result of query
body: <p>Is it possible to set an user variable based on the result of a query in MySQL? </p>
  
  <p>What I want to achieve is something like this (we can assume that both <code>USER</code> and <code>GROUP</code> are unique): </p>
  
  <pre><code>set @user = 123456;
  set @group = select GROUP from USER where User = @user;
  select * from USER where GROUP = @group;
  </code></pre>
  
  <p>Please note that I know it's possible but I do not wish to do this with nested queries.</p>