not support count+group #1836

Closed
opened 2020-11-26 07:56:39 +00:00 by RelicOfTesla · 0 comments

eq1:

n, err := db.GroupBy("level").Count(&Row{})

debug:
SELECT count(*) FROM `table1` GROUP BY level  // bad

good is
SELECT count(*) FROM ( SELECT 1 FROM `table1` GROUP BY level ) table1 // must fix it

eq2 #1726:

debug:
db.GroupBy("level").FindAndCount(&list)
SELECT `level` FROM `table1` GROUP BY level  // good
SELECT count(*) FROM `table1` GROUP BY level  // bad


good is:
SELECT `level` FROM `table1` GROUP BY level  // good
SELECT count(*) FROM ( SELECT 1 FROM `table1` GROUP BY level ) table1 // must fix it

eq1: ```sql n, err := db.GroupBy("level").Count(&Row{}) debug: SELECT count(*) FROM `table1` GROUP BY level // bad good is SELECT count(*) FROM ( SELECT 1 FROM `table1` GROUP BY level ) table1 // must fix it ``` --- eq2 #1726: ```sql debug: db.GroupBy("level").FindAndCount(&list) SELECT `level` FROM `table1` GROUP BY level // good SELECT count(*) FROM `table1` GROUP BY level // bad good is: SELECT `level` FROM `table1` GROUP BY level // good SELECT count(*) FROM ( SELECT 1 FROM `table1` GROUP BY level ) table1 // must fix it ```
lunny added the
kind
proposal
label 2020-11-26 10:24:39 +00:00
lunny added this to the 1.1.1 milestone 2021-06-06 07:52:28 +00:00
lunny closed this issue 2021-06-06 12:22:04 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1836
No description provided.