how to update entire column with different values

how to update entire column with different values

am 05.02.2010 11:38:26 von muralikrishna g

--00504502af983b3414047ed80d63
Content-Type: text/plain; charset=ISO-8859-1

hi..

i am in need to update a column with different values in a single query
i know how to update a value of single column and single row element,
and single row multiple columns. but i dont know how to update multiple
values of a single column.
if any body know the syntax for it please help me.. i am in need

thanks in advance

regards
muralikrishna4g@gmail.com

--00504502af983b3414047ed80d63--

RE: how to update entire column with different values

am 05.02.2010 11:44:12 von misiaQ

You mean the SET data type..?
http://dev.mysql.com/doc/refman/5.0/en/set.html

Regards,
m

-----Original Message-----
From: muralikrishna g [mailto:muralikrishna4g@gmail.com]
Sent: Friday, February 05, 2010 10:38 AM
To: mysql@lists.mysql.com
Subject: how to update entire column with different values

hi..

i am in need to update a column with different values in a single query
i know how to update a value of single column and single row element,
and single row multiple columns. but i dont know how to update multiple
values of a single column.
if any body know the syntax for it please help me.. i am in need

thanks in advance

regards
muralikrishna4g@gmail.com


------------------------------------------------------------ ----------
Codziennie 11 tys. ofert pracy
Sprawdz >>> http://link.interia.pl/f25ac


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

RE: how to update entire column with different values

am 05.02.2010 12:51:06 von misiaQ

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@arthaoptions.com]
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


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org