I am having trouble using Group BY in my grid SELECT statement. It seems to work but I get spurious parts of the query appearing at the top of my output page such as: GROUP BY `downloadyear` , `downloadmonthnumber` DESC ORDER BY `downloadyear` DESC
I have tried using a view (tested and working):
$g->select_command = "SELECT * FROM vw_countdownloadsbymonth";
and I have tried putting the code directly into the grid as:
$g->select_command = " SELECT
YEAR(`tbldownloadhistory`.`downloaddate`) AS `downloadyear`,
MONTH(`tbldownloadhistory`.`downloaddate`) AS `downloadmonthnumber`,
MONTHNAME(`tbldownloadhistory`.`downloaddate`) AS `downloadmonth`,
COUNT(`tbldownloadhistory`.`idtbldownloadhistory`) AS `numberofdownloads`
(NOT (`tbldownloadhistory`.`downloadIP` IN (SELECT
GROUP BY `downloadyear` , `downloadmonthnumber`";
But the results are the same with the strange text being displayed on my web page. Does using Group By in the query cause problems with the grid?
Any suggestions please?
Make sure, you call '$g->render();' function before any HTML is rendered
(echo'd) to output, as it expect exact JSON format for ajax calls. You can echo the output of render() function to desired location in html.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?