title: Is it possible to create a MySQL query like this?
body: <p>I have two tables. I would like to create a query which returns all rows from one table where the sum of the integer values from the column in the table is less than a specific value. </p>
  
  <p>Imagine the tables were like:</p>
  
  <p><code>Accounts</code>:</p>
  
  <pre><code>USERID | STATUS | LAST_LOGIN_DATE | etc......
  4594 . 1 . XX/XX/XX 00:00:00 . etc.....
  2414 . 1 . XX/XX/XX 00:00:00 . etc.....
  1894 . 1 . XX/XX/XX 00:00:00 . etc.....
  </code></pre>
  
  <p><code>History</code>:</p>
  
  <pre><code>USERID | VALUE | DATE
  4594 .   10000 . XX/XX/XX 00:00:00  
  2414 .   10000 . XX/XX/XX 00:00:00  
  1894 .   10000 . XX/XX/XX 00:00:00  
  6974 .   10000 . XX/XX/XX 00:00:00  
  3491 .   10000 . XX/XX/XX 00:00:00  
  1590 .   10000 . XX/XX/XX 00:00:00  
  6554 .   10000 . XX/XX/XX 00:00:00  
  </code></pre>
  
  <p>I would want to <code>SELECT Accounts.* FROM Accounts</code> but on the condition that e.g. for each <code>userid</code> the <code>value</code> column is less than for example <code>30,000</code>. Is that possible in MySQL? Thanks.</p>