barrycarlyon has asked for the wisdom of the Perl Monks concerning the following question:

G'day Fellow Monks

I was told that to add a order by to a search you do

my whatever = db file->search(constraints, {order_by=>'column direction'} );

However this dosent work when using search_where, can anyone offer a solution?

Update: Class::DBI, for search
And Class::DBI::AbstractSearch for the search_where

Yours, Bazza

Barry Carlyon barry@barrycarlyon.co.uk

Replies are listed 'Best First'.
Re: Using search_where with an order_by
by Gilimanjaro (Hermit) on Jul 04, 2006 at 11:50 UTC

    Well, first of all you'll want to put the constraints between curly braces too if you use order_by or limit clauses, and secondly make sure you have a recent Class::DBI::AbstractSearch version; before version 0.05 the order_by option was named order.

    Also, you may want to check the documentation for Class::DBI::AbstractSearch and SQL::Abstract to make sure you're using them to their full potential.

Re: Using search_where with a and order_by
by gellyfish (Monsignor) on Jul 04, 2006 at 11:34 UTC

    Perl doesn't have any mechanism to "add a order by to a search" so you must be using some module, perhaps you could enlighten us with more detail in this regard.

    /J\