title: SQL - Multiple request in only one
body: <p>I have a table called eod, and there is a sample of it.</p>
  
  <pre><code>| eod_id | company_symbol |    date    | open  | close | high  |  low  |
  |      1 |            AAA | 01-01-2000 | 40.00 | 42.00 | 43.00 | 39.00 |
  </code></pre>
  
  <p>For a given company_symbol, I want to:</p>
  
  <ol>
  <li>Calculate (open for a date)/(close for an other date) - 1</li>
  <li>Count the rows where open > close</li>
  <li>Count the rows where open &lt; close</li>
  <li>For each day, number of times where the company_symbol has the highest close </li>
  <li>For each day, number of times where the company_symbol has the
  lowest close</li>
  </ol>
  
  <p>I tried to get the informations I want, but I didn't succeed.
  Is it possible to get the 5 informations in only one request ?</p>
  
  <p>Hope you could help me,
  Thanks,</p>
  
  <p>Steve</p>
  
  <p>PS : What I tried :</p>
  
  <p>1.</p>
  
  <pre><code>SELECT (SELECT OPEN FROM eod WHERE company_symbol="AAPL" AND DATE="2013-04-05") 
  / (SELECT OPEN FROM eod WHERE company_symbol="AAPL" AND DATE="2000-01-03") - 1;
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>SELECT COUNT(*) FROM eod WHERE company_symbol="AAPL" AND CLOSE&gt;OPEN;
  </code></pre>
  
  <p>3.</p>
  
  <pre><code>SELECT COUNT(*) FROM eod WHERE company_symbol="AAPL" AND CLOSE&lt;OPEN;
  </code></pre>
  
  <ol>
  <li><p>SELECT COUNT(*) FROM EOD WHERE company_symbol IN (SELECT company_symbol FROM eod
  WHERE CLOSE IN (SELECT max(CLOSE) FROM eod GROUP BY DATE));</p></li>
  </ol>
  
  <p>But this one doesn't work, could you help me with this ?
  I also think those requests can be simplified, but I don't know how to.</p>