do something like: SELECT t1.date, (t1.field - t2.field) as diff FROM your_table t1, your_table t2 where t1.date = t2.date + 1;
On 8/16/05, Octavian Rasnita <[EMAIL PROTECTED]> wrote: > Hi, > > I define the previous record by date. For each record corresponds a date > which is unique and the previous record is that that contains the yesterday > date. > > Thank you. > > Teddy > > ----- Original Message ----- > From: "Felix Geerinckx" <[EMAIL PROTECTED]> > To: <mysql@lists.mysql.com> > Sent: Tuesday, August 16, 2005 2:45 PM > Subject: Re: query > > > > On 16/08/2005, "Octavian Rasnita" wrote: > > > > > I want to create a query that selects the diference between the value > > > of a field from the current record and the value of the same field > > > from the previous record. > > > > How do you define "current record" and "previous record"? > > (relational databases are not spreadsheets) > > > > -- > > felix > > > > -- > > MySQL General Mailing List > > For list archives: http://lists.mysql.com/mysql > > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- Alexey Polyakov -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]