Closed akahen closed 7 years ago
@akahen Medoo doesnt support this. Sorry.
I could help you though - but you would have to edit medoo.
This will be supported on next version v1.5
. You may check out this branch and try it.
$database->select('table', [
'account',
'sum' => Medoo::raw('SUM(<amount>)')
], [
'GROUP' => 'account'
]);
// SELECT "account", SUM("amount") AS "sum" FROM "table" GROUP BY "account"
That's great, yet that will allow only one sum or aggregate function per select. Why not take the actual column name for the implicit 'as'.
Thanks
On Sep 29, 2017 10:13 PM, Catfan notifications@github.com wrote:
This will be supported on next version v1.5. You may check out this branch and try it.
$database->select('table', [
'account',
'sum' => Medoo::raw('SUM(
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/catfan/Medoo/issues/635#issuecomment-333275141, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIUqNBaBezTUBeycSAbw5SaAeLCsJM2Aks5snaOwgaJpZM4Po2ca.
@akahen That's will be a problem and confusing if it become more complex operation.
$database->select('table', [
'account',
'sum' => Medoo::raw('SUM(<amount> + <age> + <weight>)')
], [
'GROUP' => 'account'
]);
hi, will this support an additional aggregate like below? thanks
$database->select('table', [
'account',
'sum' => Medoo::raw('SUM(
@akahen definitely
awesome, thanks. can you please update composer as well? thanks
Hi, the 'GROUP' with aggregate is not working both simple (i.e. count) and more importantly this:
select account, sum(amount), from table group by account
thanks