我使用的是甲骨文RightNow,它使用MySQL,但不能使用嵌套查询,只能使用select (双关语!)可供我使用的命令数量:PHP/Content/Connect%20for%20PHP%20API/RightNow%20Object%20Query%20Language/ROQL%20and%20Common%20Objects.htm
CASE语句不允许
假设我有
Select Count(*) as Amount, Category
From MyTable
Group by Category一切都很好,我有一张桌子,如下所示
Amount | Category
---------------------
1 | Contact Editor
4 | Incident Editor
787 | Raise a Request
78 | Pending Information如何修改我的查询,以便将前两行合并成一个新更新的表,如
Amount | Category
---------------------
5 | Editor
787 | Raise a Request
78 | Pending Information谢谢
发布于 2017-05-22 20:18:58
尝试使用case表达式进行分组:
select Count(*) as Amount, case when Category in('Contact Editor', 'Incident Editor') then 'editor' else Category end
From MyTable
Group by case when Category in('Contact Editor', 'Incident Editor') then 'editor' else Category end发布于 2017-05-22 20:22:17
select count(*),
case when Category like '%Editor' then 'Editor' else Category end as Category
From MyTable
Group by Categoryhttps://stackoverflow.com/questions/44121287
复制相似问题