List:General Discussion« Previous MessageNext Message »
From:misiaQ Date:February 5 2010 11:51am
Subject:RE: how to update entire column with different values
View as plain text  
Once you can group your rules into something reasonable you can use syntax
like this one:
UPDATE city
   SET cityClass = CASE 
                  WHEN population < 1000 
                     THEN 1 
                  WHEN population < 500000 
                     THEN 2 
                  WHEN population > 1000000 
                     THEN 4 
                  ELSE 3 
                 END
   WHERE cityId between 1 and 200;

But when each row got a separate logic - just execute multiple queries.

Reegards,
m

-----Original Message-----
From: MuraliKrishna [mailto:murali_krishna@stripped] 
Sent: Friday, February 05, 2010 10:55 AM
To: 'misiaQ'
Subject: RE: how to update entire column with different values

Whats the set data type I don't know... what I have to do is.. I have to
update the years... for a entire column...  like
Update table1
Set year= if(id=1, then 2005) 
          If(id=2, then 2003)
.... like this... 
If any body know how to make it.. please help me




----------------------------------------------------------------------
Kup wlasne mieszkanie za 72 tys. zl.
Sprawdz najlepsze oferty >>> http://link.interia.pl/f25a8

Thread
how to update entire column with different valuesmuralikrishna g5 Feb
  • RE: how to update entire column with different valuesmisiaQ5 Feb
RE: how to update entire column with different valuesmisiaQ5 Feb