[SOLVED] custom SQL statement in grid application does not work

Hello,

I have a following SQL statement and I would like to put it to the grid application. I tried but it immediately gives me an error. I tried this SQL statement in phpmyadmin and toad and it is working successfully. What is wrong with SC and how can I put this working

select
CASE STATUS
when ‘A’ then ‘READ’
when ‘U’ then ‘UNREAD’
END as status,
count(*) count
FROM CONTACT_MESSAGE
GROUP BY STATUS
WITH ROLLUP

At the grid on show, it says me following error
Error
Error while accessing the database:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘as count_1 from CONTACT_MESSAGE group by STATUS WITH ROLLUP LIMIT 0,27’ at line 4
SelectLimit(SELECT CASE STATUS when ‘A’ then ‘READ’ when ‘U’ then ‘UNREAD’ END as status, count(*) count as count_1 from CONTACT_MESSAGE group by STATUS WITH ROLLUP, 27, 0)

Perhaps:

select
CASE STATUS
when ‘A’ then ‘READ’
when ‘U’ then ‘UNREAD’
END as status,
count(*) as count
FROM CONTACT_MESSAGE
GROUP BY STATUS
WITH ROLLUP

Thanx RHS, it is working now :slight_smile: