Hello,
I am using will_paginate and want to use eager loading. but when i use
the include and order option i get an error. I am using mssqlserver2000
as database
@people
Person.paginate(:include=>[:relations],:conditions=>[''People.id
NOT IN
(Select person_id from
people_relations)''],:per_page=>20,:page=>params[:page],:order=>''last_name
ASC, first_name ASC'')
DBI::DatabaseError: Execute
OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server
ORDER BY items must appear in the select list if SELECT DISTINCT
is specified.
HRESULT error code:0x80020009
Exception occurred.: SELECT DISTINCT TOP 20 people.id FROM people LEFT
OUTER JOIN people_relations ON people_relations.person_id = people.id
LEFT OUTER JOIN relations ON relations.id = people_relations.relation_id
WHERE (People.id NOT IN (Select person_id from people_relations)) ORDER
BY last_name ASC, first_name ASC
but when i remove the include option it works fine but the results are
not sorted. Please help by last_name.
Thank you.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---