title: How can I make multiple select statements on the same table?
body: <p>I have a table that stores some student work info. I need to select the hours based on the studentID and the quarter ID. Here is what I have:</p>
  
  <pre><code>SELECT
  (SELECT hours FROM clinicalStudents WHERE quarterID='201101' and studentID='$studentID') as q1,             
  (SELECT hours FROM clinicalStudents WHERE quarterID='201102' and studentID='$studentID') as q2,             
  (SELECT hours FROM clinicalStudents WHERE quarterID='201103' and studentID='$studentID') as q3,             
  (SELECT hours FROM clinicalStudents WHERE quarterID='201104' and studentID='$studentID') as q4
  </code></pre>
  
  <p>It's only giving me some numbers but not all of them. I ran this (minus the WHERE clause) in my server manager and received an error:</p>
  
  <p>"Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, &lt;, &lt;=, >, >= or when the subquery is used as an expression"</p>
  
  <p>Any assistance would be great. Thanks!</p>
  
  <p>EDIT:</p>
  
  <p>The $studentID is generated in a while loop so I'm using the hours on that student before I move to the next one. I'm getting all the hours for one student in each quarter, adding them (this has to be done outside of the sql), storing results in a variable then moving to the next student. This works perfect when I get 1 quarter but i'm having an issue getting all the quarters.</p>
  
  <p>EDIT Round 2:
  Did it in a rather lazy way I suppose:</p>
  
  <p>I just selected all the hours and quarterID's for a specific student. Then ran a while(odbc_fetch_row()). If it was a 201101 I added it to the $q1 pile, 201102 added to the $q2 pile, and so on. Processing is a little slower but not a big issue with what I'm doing.</p>