title: Use selection from previous mysql-statement
body: <p>Basically I'm writing a bash script that is supposed to select multiple values from 2 mysql tables.</p>
  
  <pre><code>#!/bin/bash
  mysql -h "mydomain.de" "database1" &lt;&lt; EOF
  SET @user='testuser';
  SELECT serverId FROM member WHERE username = @user;
  SELECT slots FROM server WHERE id = @serverId;
  EOF
  </code></pre>
  
  <p>I set the variable for @user for testing purposes, normally it's given by a php script.</p>
  
  <p>I just don't know how to use the result I get from the first SELECT statement ( the serverId ) to be used in the second SELECT statement in order to find out the slots this server contains.</p>