Domanda

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.

È stato utile?

Soluzione

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 ;

Altri suggerimenti

Is it a query you need?

update mytable set win = 'WIN' where place <= 3;
update mytable set win = 'LOSS' where place > 3;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top