http://i61.tinypic.com/21dexc6.png

I would like to fill the win column with the classifications win or lose with win defined as 1-3 place finish and loss as everything else.

有帮助吗?

解决方案

UPDATE table set win = 'lose' WHERE place NOT in (1,2,3);
UPDATE table set win = 'win' WHERE place in (1,2,3);

OR with a little CASE statement

UPDATE table set win =  CASE WHEN place IN (1,2,3) THEN 'win' 
                             WHEN place NOT IN (1,2,3) THEN 'lose' 
                        END ;

其他提示

Is it a query you need?

update mytable set win = 'WIN' where place <= 3;
update mytable set win = 'LOSS' where place > 3;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top