-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
duplicate join clause when using scan() count(), find() count() is normal #7079
Comments
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the |
yeah i also started facing this same issue after upgrading gorm, it used to work fine before. |
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the |
Description
In the example above, it is Find(), and it's normal, but it fails if I replace it with Scan() and it would be this SQL statement:
SELECT COUNT(DISTINCT(
sr
.s_id
)) FROM table_s_r as sr left join table_s_m sm on sr.s_id= sm.s_id left join table_s_m sm on sr.s_id= sm.s_idAnd you can notice that there's a duplicate 'left join' in it.
Then mysql throws an error: [1066] [42000]: Not unique table/alias: 'sm'
The text was updated successfully, but these errors were encountered: