Skip to content
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

Problem with paginate on sql server 2005 #119

Open
accessd opened this issue Mar 31, 2011 · 0 comments
Open

Problem with paginate on sql server 2005 #119

accessd opened this issue Mar 31, 2011 · 0 comments

Comments

@accessd
Copy link

accessd commented Mar 31, 2011

In the project I use MS SQL Server 2005
Pagination works well if I do inquiry:
Tariffication.paginate(:page => 1, :per_page => 30)
But doesn't work on inquiry:
Tariffication.includes(:otdel).paginate(:page => 1, :per_page => 30)
With an error: Ambiguous column name 'ID'.
Thus generated inquiry (in a short form) following:
SELECT TOP (30) t0_r0, t1_r2 FROM ( SELECT ROW_NUMBER() OVER (ORDER BY ID ASC) AS [__rn], [t_main].[ID] AS t0_r0, [t_Otdel].[Name] AS t1_r2 FROM [t_main] LEFT OUTER JOIN [t_Otdel] ON [t_Otdel].[ID] = [t_main].[ID_t_Otdel] ) AS [__rnt] WHERE [__rnt].[__rn] > (0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant