Answered
SUM() help please
I have a relational recordset (which is now quite complex)
and all I want to do is to create a single SUM value at the top of
the dynamic table column.
I have looked around and understand the concept of SUM() and GROUP BY.
Does this mean that I need another recordset or can I build it into the existing one?
Do you definately need to include the GROUP BY statement? I don't want multiple values.
Here is a simplified version of the select code I have so far: (separate recordset) I don't think this needs to have the relational data inner join.
SELECT SUM(VALUE)
FROM NOTES
WHERE NOTES.EDITEDBY Like 'fielduser' AND NOTES.EDITDATE>='fielddatefrom' AND NOTES.EDITDATE<=Now()
GROUP BY ??????
Lastly, I believe the recordset has to be via a dynamic table (for multiple results) but I want just one value sitting in the column head
<td>VALUE <?php echo $row_recordset['SUM(NOTES.VALUE)']; ?></td>.
Much simpler in Excel!
I have looked around and understand the concept of SUM() and GROUP BY.
Does this mean that I need another recordset or can I build it into the existing one?
Do you definately need to include the GROUP BY statement? I don't want multiple values.
Here is a simplified version of the select code I have so far: (separate recordset) I don't think this needs to have the relational data inner join.
SELECT SUM(VALUE)
FROM NOTES
WHERE NOTES.EDITEDBY Like 'fielduser' AND NOTES.EDITDATE>='fielddatefrom' AND NOTES.EDITDATE<=Now()
GROUP BY ??????
Lastly, I believe the recordset has to be via a dynamic table (for multiple results) but I want just one value sitting in the column head
<td>VALUE <?php echo $row_recordset['SUM(NOTES.VALUE)']; ?></td>.
Much simpler in Excel!
