You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varcountint64vartempList []inttest:=global.GetTransaction().Table(e.TableName() +" as sr").Joins("left join table_s_m sm on sr.s_id = sm.s_id ")
err2:=test.Distinct("sr.s_id ").Order("sr.s_id desc").Offset((current-1) *pageSize).Limit(pageSize).Find(&tempList).Offset(-1).Limit(-1).Count(&count).Error
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_id
And 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:
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 Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking ✨
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: