I've got a table which looks like:
>Date--Country--Courier--Division--Volume
>
>datetime--varchar--varchar--varchar--varchar--int
>
>datetime--varchar--varchar--varchar--varchar--int
All this data is gathered in a temp table and represents a month worth data.
The final scope is to change the countries which have TOTAL volume less than a value to 'others'.
FOR example:
>Country -- Volume
>
>Germany -- 1200
>
>Albania -- 250
I want to change it to:
>Country -- Volume
>
>Germany -- 1200
>
>Other -- 250
I've been trying to make an IF statement based on
SUM(Volume) OVER(PARTITION BY Country) < x
But it looks like I m far from achieving this.
Would appreciate any help.
Thank you.
1条答案
按热度按时间6ojccjat1#
From a logic point of view, you could proceed in the following way:
Given that yor data could be:
You'd get: