Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- league_id user_id outcome_id
- 5 1 1
- 5 1 4
- 5 2 1
- league_id user_id outcome_id
- 5 1 FAIL
- 5 2 PASS
- SELECT league_id,user_id,
- CASE WHEN outcome=0 THEN 'PASS' ELSE 'FAIL' END as outcome_id
- FROM
- (
- SELECT league_id,user_id,SUM(CASE WHEN outcome_id=4 THEN 1 ELSE 0 END) as outcome
- FROM tableName
- GROUP BY league_id,user_id
- ) As Z
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement