I'm using Oracle RightNow which uses MySQL but can't have nested queries and only a select (pun!) number of commands at my disposal: http://documentation.custhelp.com/euf/assets/devdocs/august2016/Connect_PHP/Content/Connect%20for%20PHP%20API/RightNow%20Object%20Query%20Language/ROQL%20and%20Common%20Objects.htm
CASE statements are not permitted
Let's say I have
Select Count(*) as Amount, Category
From MyTable
Group by Category
All is well and I get a table as below
Amount | Category
---------------------
1 | Contact Editor
4 | Incident Editor
787 | Raise a Request
78 | Pending Information
How would I need to amend my query so I could combine the first two rows to have a new updated table as
Amount | Category
---------------------
5 | Editor
787 | Raise a Request
78 | Pending Information
Thanks
Try grouping using case expression:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With