Question

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.

Was it helpful?

Solution

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 ;

OTHER TIPS

Is it a query you need?

update mytable set win = 'WIN' where place <= 3;
update mytable set win = 'LOSS' where place > 3;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top