Subject: | group_by with rows for RowCountOrGenericSubQ limit types loses group_by |
I have an ASE server with log entries. I'm running a query that will
give me the top 5 users in a given time period.
my $rs = $schema->resultset('Log')->search({},{rows => 5,
group_by=>[qw/userId/]})
diag $rs->as_query;
# \[
# '(SET ROWCOUNT 5
# SELECT [me].[date], [me].[userId], [me].[itemId], [me].[serverId],
[me].[fileId], [me].[appId], [me].[queries] FROM [usage] [me]
# SET ROWCOUNT 0
# )'
# ]
But if I remove the rows=>5, I get the group by.
my $rs = $schema->resultset('Log')->search({},{group_by=>[qw/userId/]});
diag $rs->as_query;
# \[
# '(SELECT [me].[date], [me].[userId], [me].[relationId],
[me].[serverId], [me].[fileId], [me].[appId], [me].[queries] FROM
[mim_usage] [me] GROUP BY [userId])'
# ]
Tracing through SQLA and SQLMaker, I could not find the place where
Group By was added, but if there's any other information I can provide,
let me know.