I have a bunch of rows with a certain date that entered the mysql table as zeros. I would love to know a query that will loop through updating one date's values for every row (matching eg fieldname1 and fieldname2) with the previous date's values. I can do it manually or build a php script, but ideally a single mysql update statement would be handy!
dateset fieldname1 fieldname2 value
2013-01-20 a b 0
2013-01-20 a c 0
2013-01-19 a b 1.2345
2013-01-19 a c 5.4321
you cannot update a table and reference the same table in the same statement
besides, if you were able to do it, you would update the 20th's data to the 19th's, and the 19th's data to the 18th's, and so on... or even worse, update the 17th's data to the 18th's, and then the 18th's data to the 19th's, and then the 19th's data to the 20th's...