MySQL Forums
Forum List  »  Newbie

Re: Using user variables in UPDATE?
Posted by: Ramalingam Chelliah
Date: August 16, 2004 01:31AM

Hi ,
I tried user variables within paranthesis ...
Will this help you ?

update import i, pricelists p
i._pricelist=( @pl:=substring_index(i.pricelist_currency, ' ', 1))
i._currency_code= p.currency_code
where i._pricelist=p.pricelist;

or just place the @pl value in where clause

where p.pricelist=substring_index(i.pricelist_currency, ' ', 1)

There is a note saying that user variables can be used in place of expressions...and a similar usage of user variables within paranthesis
in the man page
http://dev.mysql.com/doc/mysql/en/Variables.html

mysql> SELECT @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;


Hope this helps,

Regards,
Ram.

Options: ReplyQuote


Subject
Written By
Posted
August 14, 2004 07:51AM
Re: Using user variables in UPDATE?
August 16, 2004 01:31AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.