diff --git a/phpmyfaq/src/phpMyFAQ/Faq.php b/phpmyfaq/src/phpMyFAQ/Faq.php index 9278d08b9f..34b1b11308 100755 --- a/phpmyfaq/src/phpMyFAQ/Faq.php +++ b/phpmyfaq/src/phpMyFAQ/Faq.php @@ -1151,11 +1151,14 @@ public function getFaqBySolutionId(int $solutionId): void $queryHelper = new QueryHelper($this->user, $this->groups); $query = sprintf( 'SELECT - * + fd.*, COALESCE(fdg.group_id, -1) AS group_id, fdu.user_id FROM %sfaqdata fd - LEFT JOIN - %sfaqdata_group fdg + LEFT JOIN ( + SELECT record_id, group_id FROM %sfaqdata_group fdg WHERE fdg.group_id <> -1 + UNION ALL + SELECT fd.id AS record_id, -1 AS group_id FROM %sfaqdata fd WHERE fd.solution_id = %d + ) AS fdg ON fd.id = fdg.record_id LEFT JOIN @@ -1169,6 +1172,8 @@ public function getFaqBySolutionId(int $solutionId): void Database::getTablePrefix(), Database::getTablePrefix(), $solutionId, + Database::getTablePrefix(), + $solutionId, $queryHelper->queryPermission($this->groupSupport) );