hgaol opened a new pull request, #1311:
URL: https://github.com/apache/answer/pull/1311

   Close #1310 .
   
   I planned to use `session.Distinct("question.*")` but met error when it 
execute `FindAndCount` in Help func. The current approach works for 
`FindAndCount`. The SQL looks like
   
   ```sql
   [xorm] [info]  2025/04/15 22:00:52.962709 [SQL] SELECT question.* FROM 
`question` LEFT JOIN `tag_rel` ON question.id = tag_rel.object_id WHERE 
`question`.`status` IN (?,?) AND `tag_rel`.`tag_id` IN (?,?,?) AND 
(tag_rel.status = ?) AND (question.show = ?) GROUP BY question.id ORDER BY 
question.pin desc,question.created_at DESC LIMIT 10 [1 2 10030000000000041 
10030000000000042 10030000000000002 1 1] - 737.525µs
   
   [xorm] [info]  2025/04/15 22:00:52.963977 [SQL] SELECT count(*) FROM (SELECT 
question.id FROM `question` LEFT JOIN `tag_rel` ON question.id = 
tag_rel.object_id WHERE `question`.`status` IN (?,?) AND `tag_rel`.`tag_id` IN 
(?,?,?) AND (tag_rel.status = ?) AND (question.show = ?) GROUP BY question.id) 
sub [1 2 10030000000000041 10030000000000042 10030000000000002 1 1] - 418.635µs
   ```
   
   <img width="1110" alt="image" 
src="https://github.com/user-attachments/assets/40b73f89-0618-4c3b-991d-cb9a73c9bfef";
 />
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to