MySQL SUM Query
Hia, first hello to everybody I'm new to the forum :-)
I'm totally lost with a complicated sql query, can smbdy help me ? Look : I got a table with reparations incommings: Fields : RepID, RepDateTime, RepTotalCost Now I'd like to SUM() all incomming reparations for each day in the table. Is it possible to do it in one query ? Hope :-P zimba |
select SUM(RepTotalCost) from db where RepDateTime<somevalue and RepDateTime>othervalue;
u may use BETWEEN function in the where clause too if u want to select sums of a lot of days at once i guess u need to make a temporary table for each day or switch to a db that supports subselects |
Thanks a lot j-ray,
I just read today that MySQL 4.1 supports subselects so I don't have to change my DB, just upgrade :-P cf. MySQL Press Release 21 Jan 2003 thanx, zimba |
nice to hear that. it's a great improvement that was announced for long. gonna get me that too. ;-)
cheers, jens |
All times are GMT -5. The time now is 07:27 PM. |