Eliminating Duplicates

6 views
Skip to first unread message

Jade Zallao

unread,
Feb 9, 2012, 11:47:31 AM2/9/12
to Ruby on Rails: Talk
How will I convert this into searchlogic query?


@students = Students.find_by_sql(["SELECT DISTINCT * FROM students
WHERE first_name LIKE ? OR last_name LIKE ? GROUP BY first_name,
last_name, middle_name", params[:first_name], params[:last_name] ])

Thank you,

Jade

John Hinnegan

unread,
Feb 9, 2012, 12:39:20 PM2/9/12
to rubyonra...@googlegroups.com
Pretty sure something like this will work
Students.where("first_name like ?", params[:first_name]).or("last_name like ?", params[:last_name]).group("first_name, last_name, middle_name").uniq
Reply all
Reply to author
Forward
0 new messages