Skip to content

Commit

Permalink
Updated SQL for mysql 8
Browse files Browse the repository at this point in the history
- ASC after the group by throws an exception in mysql 8
  • Loading branch information
SnowB1 committed Oct 1, 2024
1 parent f216de2 commit 6669f68
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/SearchQueries/CustomeSideReport_SearchQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ public function title()
{
return 'Search Query Report';
}

public function description()
{
$desc = 'Shows search queries';

return $desc;
}

public function sort()
{
return 1;
}

public function records($params = null)
{
if ($params){
Expand All @@ -40,13 +40,15 @@ public function records($params = null)

$records = new ArrayList();
$sql = "
SELECT
Created, Query, COUNT(*) AS QueryCount
SELECT
Max(Created) as Created, Query, COUNT(*) AS QueryCount
FROM
SearchQuery
WHERE
Created BETWEEN '".$StartDate."' AND '".$EndDate."'
GROUP BY
Query
ORDER BY
Query ASC
";
$results = DB::query($sql);
Expand All @@ -63,13 +65,13 @@ public function records($params = null)

return $records;
}

public function sourceRecords($params = null)
{
$params = ((isset($_REQUEST['filters'])) ? $_REQUEST['filters'] : null);
return $this->records($params);
}

public function columns()
{
$fields = [
Expand All @@ -86,8 +88,8 @@ public function columns()

return $fields;
}
public function parameterFields()

public function parameterFields()
{
$today = date('Y-m-d');

Expand Down

0 comments on commit 6669f68

Please sign in to comment.