Fix some annoyances with joins
This commit is contained in:
parent
c6e8c87f28
commit
d3933f53af
1 changed files with 7 additions and 7 deletions
|
@ -303,27 +303,27 @@ sub post_supplier_history {
|
||||||
order_by => { '-asc' => 'organisation.name' },
|
order_by => { '-asc' => 'organisation.name' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
my $quarter_year_rs = $c->schema->resultset('Transaction')->search(
|
my $quarter_year_rs = $c->schema->resultset('Entity')->search(
|
||||||
{
|
{
|
||||||
'me.purchase_time' => {
|
'sales.purchase_time' => {
|
||||||
-between => [
|
-between => [
|
||||||
$dtf->format_datetime($third),
|
$dtf->format_datetime($third),
|
||||||
$dtf->format_datetime($last),
|
$dtf->format_datetime($last),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'me.buyer_id' => $user->entity->id,
|
'sales.buyer_id' => $user->entity->id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
join => { seller => 'organisation' },
|
join => [ 'sales', 'organisation' ],
|
||||||
columns => [
|
columns => [
|
||||||
{
|
{
|
||||||
id => 'me.seller_id',
|
id => 'me.id',
|
||||||
name => 'organisation.name',
|
name => 'organisation.name',
|
||||||
count => \"COUNT(*)",
|
count => \"COUNT(*)",
|
||||||
total_spend => { sum => 'me.value' },
|
total_spend => { sum => 'sales.value' },
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
group_by => 'me.seller_id',
|
group_by => [ 'me.id', 'organisation.name' ],
|
||||||
order_by => { '-asc' => 'organisation.name' },
|
order_by => { '-asc' => 'organisation.name' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Reference in a new issue