Merging database rows with query or php array?

Ok, so my database has 4 categories.

Name Date Money Bricks

What I need to do is when Name and Date match up, the money and brick fields need to be added up and combined into one entry. It seems like it’d be way easier to dump them into an array and manipulate that way, but then I don’t know how to replace the previous rows with the one new row…

So for instance if I have

Name Date Money Bricks
Joe 2010-07-22 1000 0
Joe 2010-07-22 8000 2

I’d like it to turn them into one row that reads

Joe 2010-07-22 9000 2

Hi you can use the mysql concat if you just want to show them as a query result.

select concat(Name,’ ‘,Date,’ ‘,Money,’ ', Bricks) as onrow from yourtable;

when match found you may create a new record (before that store the matched ids in a new variable) and delete the old records if its a smaller db.