replace awkward aggregate with correlated subquery (frew++)
This commit is contained in:
@@ -59,10 +59,16 @@ sub with_vlan_count {
|
|||||||
->search_rs($cond, $attrs)
|
->search_rs($cond, $attrs)
|
||||||
->search({},
|
->search({},
|
||||||
{
|
{
|
||||||
'+select' => [ { count => 'port_vlans_tagged.vlan' } ],
|
'+columns' => { tagged_vlans_count =>
|
||||||
'+as' => [qw/ tagged_vlans_count /],
|
$rs->result_source->schema->resultset('DevicePortVlanTagged')
|
||||||
join => 'port_vlans_tagged',
|
->search(
|
||||||
distinct => 1,
|
{
|
||||||
|
'dpvt.ip' => { -ident => 'me.ip' },
|
||||||
|
'dpvt.port' => { -ident => 'me.port' },
|
||||||
|
},
|
||||||
|
{ alias => 'dpvt' }
|
||||||
|
)->count_rs->as_query
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user