Find_by_sql distinct


#1

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


#2

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