You are here: Re: Swapping values in mysql fields - possible (easy)? « PHP SQL « IT news, forums, messages
Re: Swapping values in mysql fields - possible (easy)?

Posted by Norman Peelman on 02/21/07 11:29

Captain Paralytic wrote:
> On 21 Feb, 02:00, "David Smithz" <dave1...@blueyonder.co.uk> wrote:
>> "Paul Lautman" <paul.laut...@btinternet.com> wrote in message
>>
>> news:5416e9F1ug8raU1@mid.individual.net...
>> In fact I have now managed to try it on an isolated row that I fixed
>> afterwards and unfortunately it works how I don't want it to. Therefore both
>> the fields become the same value.
>>
>> So how can I achieve this?
>
> This one works
>
> UPDATE `exampletable`
> SET `field1` = @tmp := `field1`, `field1` = `field2`,
> `field2` = @tmp
> WHERE `field3` = value
>

They both work. And yes, another good example. You need to use := to
set the variable and = to read it.

Norm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация