I have a data table that contains website traffic log information like this
date ip country duration
02/12/2013 * USA 455
02/13/2013 * CA 1234
02/14/2013 * Cambodia 13
02/12/2013 * USA 12
03/11/2013 * Korea 11
....
Now I want to do an sum/group by aggregate query that sums up total visit durations by country, but I want to produce only three groups (USA, Canada, Everyone Else)
And produce an ideal output like this:
country sum(durations)
USA 123456789
Canada 55555679
Everyone Else 696969
Is it possible to do this in a single query?
UNION2 queries : 1 for the USA & Canada and 1 for others...