Update table column rows with top dimension values and rest as others
I have fact table, say main_table with 30 OS Types and values for each.
The values in table look some thing like below:
DATE OS_TYPE MEASURE1 MEASURE2
09/01/2013 WI8
09/01/2013 WI7
09/01/2013 WXP
09/01/2013 MAC
09/01/2013 WI8
09/01/2013 WI7
09/01/2013 OTH
09/01/2013 MAC
09/01/2013 WI8
09/01/2013 WI8
We also have a dimension table which gives a full name to the above OS
Type. The dimension_table looks some thing like below:
OS_TYPE OS_NAME
WI8 Windows 8
WI7 Windows 7
MAC MAC
WXP Windows XP
NXP OTHER
PS3 OTHER
POS OTHER
.. 25 other types
i listed the top 10 OS types from main_table.
SELECT TOP 10 OS_TYPE FROM main_table ORDER BY measure1 WHERE EVENT_DT
BETWEEN '2013-09-01' AND current_date
i was able to get this working.
now, i would require some help updating the dimension table.
what i want to do is update the dimension_table with only top 10 os_type
with the full names and rest os_types with name "other".
hope i was clear..
please let me know.
thanks for reading through my request.
No comments:
Post a Comment