Last issue for a while, I promise. So I copied over the sales by month graph logic, and it works. But now I want to stack the bars by user. I'm not exactly sure how flotr wants that data but right now I can't get sql to cooperate.
The original was:
And that correctly gets the sum of all gallons. But I want it split up by user. Trying ->group('assignedUserName') throws an error saying the column doesn't exist. For sanity check requesting select * shows that it does exist.
That doesn't throw an error, but only returns the first entry in the month.
Worst case scenario I take select * and sort the entries on the php side, but that seems silly. There must be something I'm missing.
The original was:
HTML Code:
$whereClause[] = [
'collectionDate>=' => $from->toString(),
'collectionDate<' => $to->toString(),
];
$queryBuilder
->select([
['MONTH:collectionDate', 'month'],
['SUM:gallonsCollected', 'gallonsCollected']
])
->order('MONTH:collectionDate')
->group('MONTH:collectionDate')
->where($whereClause);
HTML Code:
->select([
['MONTH:collectionDate', 'month'],
['gallonsCollected', 'gallonsCollected'],
['assignedUserName', 'assignedUserName']
])
->order('MONTH:collectionDate')
->group('MONTH:collectionDate')
->where($whereClause);
Worst case scenario I take select * and sort the entries on the php side, but that seems silly. There must be something I'm missing.

Comment