最终输出应该像图像(HELLO WORLD):

这是我在做什么: -
$im = imagecreate(400,400);
$txtcol = imagecolorallocate($im, 0xFF, 0x00, 0x00);
$size = 20;
$txt = 'DUMMY TEXT';
$font = './font/Capriola-Regular.ttf';
/*two points for base line*/
$x1 = 50; $x2 = 300;
$y1 = 150; $y2 = 170;
/*bof finding line angle*/
$delta_x = $x2-$x1;
$delta_y = $y2-$y1;
$texangle = (rad2deg(atan2($delta_y,$delta_x)) * 180 / M_PI)-360;
/*eof finding the line angle*/
imageline($im,$x1,$y1,$x2,$y2,$txtcol); //Drawing line
imagettftext($im, $size, $texangle, $x1, $y1, $txtcol, $font, $txt); // Drawing text over line at line's …Run Code Online (Sandbox Code Playgroud) 我需要在指定月份的一天内获取'grand_total'的订单总数,SUM,MIN MAX和AVG.这就是我在做的事情.
$collection->getSelect()
->columns( 'SUM(base_grand_total) AS total' )
->columns( 'COUNT(*) AS orders_count' )
->columns( 'DATE_FORMAT(created_at, "%d") AS order_day' )
->columns( 'DATE_FORMAT(created_at, "%d/%m/%y") AS order_date' )
->columns( 'AVG(base_grand_total) AS avg_total' )
->columns( 'MAX(base_grand_total) AS max_total' )
->columns( 'MIN(base_grand_total) AS min_total' )
->where( 'DATE_FORMAT(created_at, "%m") = ?', $month )
->where( 'DATE_FORMAT(created_at, "%Y") = ?', $year )
->group( 'DATE_FORMAT(created_at, "%d-%m-%y")' );
Run Code Online (Sandbox Code Playgroud)
$ month是"Sep",$ year是"2014"


上面的查询说26日有3个订单,但是magento的Sales> Order网格表示只有一个订单在第26个.我猜答案在于," created_at "在DB中存储为"2014-09-04 02:50:04",但是如果我们将其格式化为"2014年9月3日下午4:50:04".
那么,任何人都可以建议如何在Collection上应用group by date子句.
提前致谢.