I have the following table:
I want to perform the sum of sueldo1
and sueldo 2
, use SUM();
but that makes me add the two columns but in all the calendars.
Is there any way to make the sum of both columns but by calendar?
That is, add the 2 columns of the calendar to 7 and give me one Total
per calendar. And so on for all calendars or is there an alternative to do those sums from PHP
and avoid doing them in MySQL
?
I think you are looking for something like this
Or if you want each column separately it would be
and you could add a where clause if you only want to see those of a particular id
Sum of columns salary1 and salary2 grouped by calendars_id