Find_by_sql distinct

hey,

i have this sql statement
@all_clients = Client.find_by_sql(“select distinct * from clients
…”)

is there any other way for implementing this “distinct” into an sql
statment
with parameters??

thanks in adavance
Nick

Yes, with

@all_clients = Client.find(:all, :select => “DISTINCT x”

where x will be the column you want to discriminate with.

Brutyn N. wrote:

hey,

i have this sql statement
@all_clients = Client.find_by_sql(“select distinct * from clients
…”)

is there any other way for implementing this “distinct” into an sql
statment
with parameters??

thanks in adavance
Nick

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs