[Dbix-class] Searching N rows sorting randomly

Alberto Simões hashashin at gmail.com
Sat Nov 28 17:19:06 GMT 2009


Hello

When using SQLite directly I used

  SELECT word FROM words ORDER BY RANDOM() LIMIT 10;

to get 10 random words from a database.
I am trying to do the same query using DBIx::Class, but not sure what
to set as order_by clause:

            my @words = $schema->resultset('Word')->search(undef,
                                                           {rows => $LIMIT,
                                                            order_by => ...????
                                                            columns =>
['word']});

Thanks in advance,
ambs
-- 
Alberto Simões



More information about the DBIx-Class mailing list