set @i=0; set @precprest=''; select cmd.no_client,cmd.no_cmd,cmd.no_prest,eye.libelle,hair.libelle, @precprest as b,if(@i=0,0,@precprest:=cmd.no_prest),@i:=@i+1
It s like if the "if" was evaluate one time. To: <[EMAIL PROTECTED]> Sent: Saturday, December 15, 2001 10:16 PM Subject: Re: how to make a reference to previous row into a sql statement > set @precprest=''; > select cmd.no_client,cmd.no_cmd, > @i:=@i+1,@precprest:=cmd.no_prest as b, if(@i>1,0,1) > from > > I can make a variable depending on the row because > @i:=@i+1 dispaly 1,2,3 .... > but if(@i>1,0,1) is always 1 the value at the end of the thread. > > Can make an something to memorize the previous value of a column ? > > > > ----- Original Message ----- > From: "David Yahoo" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, December 15, 2001 9:42 PM > Subject: how to make a reference to previous row into a sql statement > > > > Hi, > > > > I know that mysql can reference var into sql statement, I think like > > @var, i cant retrieve this info. > > > > ..... > > > > > > > > > > --------------------------------------------------------------------- > > Before posting, please check: > > http://www.mysql.com/manual.php (the manual) > > http://lists.mysql.com/ (the list archive) > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php