RSS | Archive | Random | E-mail

About

Hi, I'm Christian Castelli, a 28 years old italian programmer located in Pisa (Italy). Here I post small snippets of code which can be useful in my work.

Links

Codepuzzling main site
Development site
ByteStrike italian blog
Follow me on Twitter

My Life Style

while(passion) {
  try {
    myLife.run();
  }catch(LifeExceptions) {  
    stronger++;
    continue;
   }
}

Following

4 September 09

[MySQL] How to swap columns values in a table

I find a very useful webpage on how to swap columns values in MySQL. In that article are presented three methods, of which I’ve chosen the following one which makes use of a temporary variable:

UPDATE table
SET x=(@temp:=x), x = y, y = @temp 
WHERE condition....

Tags: MySQL SQL
Comments (View)
blog comments powered by Disqus
Themed by Hunson. Originally by Josh