Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- date val count
- 2017-01-25 ua5 50
- 2017-01-25 ua6 49
- 2017-02-25 ua8 35
- 2017-02-25 ua3 20
- 2017-01-25 ua1 2
- 2017-01-25 ua2 2
- 2017-02-25 ua9 1
- 2017-02-25 ua7 1
- 2017-01-25 ua4 1
- date val count
- 2017-01-25 ua5 50
- 2017-01-25 ua6 49
- 2017-02-25 ua8 35
- 2017-02-25 ua3 20
- 2017-01-25 other 5
- 2017-02-25 other 2
- select date, (case when count <= 10 then 'other' else val end) as val, sum(count)
- from table t
- group by date, (case when count <= 10 then 'other' else val end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement