Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQL Oracle组合多个结果行_Sql_Oracle - Fatal编程技术网

SQL Oracle组合多个结果行

SQL Oracle组合多个结果行,sql,oracle,Sql,Oracle,我有以下疑问 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 Insta

我有以下疑问

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

您是按现场设备_模型分组,而不是按表达式分组:

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
case upper(device_model)
    when 'IPHONE' then 'iOS - iPhone'
    when 'IPAD' then 'iOS - iPad'
    when 'IPOD TOUCH' then 'iOS - iPod Touch'
    Else 'Android'
    End
Order By Device_Model
选择
外壳上部(装置\ U型)
当“IPHONE”之后是“iOS-IPHONE”
当“IPAD”之后是“iOS-IPAD”
当“IPOD TOUCH”时,然后是“iOS-IPOD TOUCH”
还有“安卓”
结束时为设备(U型),,
在安装时计算(创建时间)\u Oct17\u Oct30
来自玩家
其中创建日期>=截止日期('2012-10-17','yyyy-mon-dd')

并创建\u Dtime您是按现场设备\u模型分组的,而不是按表达式分组的:

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
case upper(device_model)
    when 'IPHONE' then 'iOS - iPhone'
    when 'IPAD' then 'iOS - iPad'
    when 'IPOD TOUCH' then 'iOS - iPod Touch'
    Else 'Android'
    End
Order By Device_Model
选择
外壳上部(装置\ U型)
当“IPHONE”之后是“iOS-IPHONE”
当“IPAD”之后是“iOS-IPAD”
当“IPOD TOUCH”时,然后是“iOS-IPOD TOUCH”
还有“安卓”
结束时为设备(U型),,
在安装时计算(创建时间)\u Oct17\u Oct30
来自玩家
其中创建日期>=截止日期('2012-10-17','yyyy-mon-dd')

创建\u Dtime无需按大字段分组。。。只需使用下面的简单查询。。 [您的sql] 按1分组 按设备型号订购

这意味着您在select查询中按字段1分组。。或者尝试给出别名。。 按别名分组
按设备订购\u型号

无需按大字段分组。。。只需使用下面的简单查询。。 [您的sql] 按1分组 按设备型号订购

这意味着您在select查询中按字段1分组。。或者尝试给出别名。。 按别名分组 按设备型号订购