SQL Oracle Combining Multiple Results Rows

Posted by Stuav on Stack Overflow See other posts from Stack Overflow or by Stuav
Published on 2012-10-31T22:48:56Z Indexed on 2012/10/31 23:00 UTC
Read the original article Hit count: 106

Filed under:
|

I have the below query

Select 
case upper(device_model)
        when 'IPHONE' then 'iOS - iPhone'
        when 'IPAD' then 'iOS - iPad'
        when 'IPOD TOUCH' then 'iOS - iPod Touch'
        Else 'Android'
        End As Device_Model,
count(create_dtime) as Installs_Oct17_Oct30
From Player
Where Create_Dtime >= To_Date('2012-Oct-17','yyyy-mon-dd')
And Create_Dtime <= To_Date('2012-Oct-30','yyyy-mon-dd')
Group By Device_Model
Order By Device_Model

This spits out multiple rows of results that read "Android"....I would like there to be only 4 results rows, one for each case....so it comes out like this:

Device_Model     Installs_Oct17_Oct30
Android            987
iOS - iPad         12003
iOS - iPhone       8563
iOS- iPod Touch    3482

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle