Skip to content

Commit

Permalink
group sql is being weird
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlan-00 committed May 14, 2024
1 parent f7db6e6 commit 9e0b53b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Repository/Model/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -1143,24 +1143,22 @@ public function get_sql($limit = true): string
$sql = $this->_get_base_sql();
$filter_sql = "";
$join_sql = "";
$group_sql = "";
$having_sql = "";
$order_sql = "";
if (!$this->_state['custom']) {
$filter_sql = $this->_get_filter_sql();
$join_sql = $this->_get_join_sql();
$group_sql = $this->_get_group_sql();
$having_sql = $this->_get_having_sql();
$order_sql = $this->_get_sort_sql();
}
$limit_sql = $limit ? $this->_get_limit_sql() : '';
$final_sql = $sql . $join_sql . $filter_sql . $having_sql;

if (!$this->_state['custom']) {
if ($this->get_type() == 'artist' || $this->get_type() == 'album') {
if (!empty($this->_get_group_sql())) {
$final_sql .= " GROUP BY " . $this->_get_group_sql() . " ";
} elseif ($this->get_type() == 'artist' || $this->get_type() == 'album') {
$final_sql .= " GROUP BY `" . $this->get_type() . "`.`name`, `" . $this->get_type() . "`.`id` ";
} elseif (!empty($group_sql)) {
$final_sql .= " GROUP BY " . $group_sql . " ";
}
}

Expand Down

0 comments on commit 9e0b53b

Please sign in to comment.