title: Invalid column in select list with group by in SQL Server
body: <p>I have the following query:</p>
  
  <pre><code>select
      fooditemid,
      sum(mealsize) as mealsize,
      mealdate
  from Phase2FoodItems
  where`
      userid = 190
      and mealdate between
          (select dietstartdate from Users where userid = 190)
          and GETDATE()
  group by mealdate
  </code></pre>
  
  <p>I understand that this is basically asking SQL to give me data without providing enough information (it doesn't know what it should do with columns not specified in the group by, i.e. sum, average, etc).</p>
  
  <p>Unfortunately, adding all the rest of the columns into the group by doesn't give me the sum'd values I'm looking for, for the <code>mealsize</code> column. In fact, the data I'm getting back is exactly the same as what I'd get without the sum and group by.</p>
  
  <p>I think I'm missing a concept here, can anyone explain and/or suggest a new sql statement that will get me the sum of the mealsize column for each value in the mealdate column?</p>