Skip to content

Commit

Permalink
Use a subselect instead of join because newer mysql doesn't like the …
Browse files Browse the repository at this point in the history
…aggregate functions without telling it how to group the other columns
  • Loading branch information
Isaac Connor committed Sep 18, 2023
1 parent 4410757 commit b22ef6f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions scripts/ZoneMinder/lib/ZoneMinder/Filter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,9 @@ sub Sql {
E.*,
unix_timestamp(E.StartDateTime)
AS Time,
GROUP_CONCAT(T.Name SEPARATOR ", ")
CONCAT_WS(", ", (SELECT Name FROM Tags WHERE Id IN (SELECT TagId FROM Events_Tags WHERE EventId=E.Id)))
FROM Events
AS E
LEFT JOIN Events_Tags
AS ET
ON E.Id = ET.EventId
LEFT JOIN Tags
AS T
ON T.Id = ET.TagId
';

if ( $filter_expr->{terms} ) {
Expand Down

0 comments on commit b22ef6f

Please sign in to comment.