Re: Order By using related objects

[prev] [thread] [next] [Date index for 2005/04/13]

From: d. Taylor Singletary
Subject: Re: Order By using related objects
Date: 19:23 on 13 Apr 2005
Thanks, this is indeed a small dataset, so it's fine to do it in perl.

sort { $a->vndrid->busname cmp $b->vndrid->busname } @vendors;

works great.

Class::DBI has made my life easier in so many ways.

d. Taylor Singletary

On Wed, 2005-04-13 at 19:31 +0100, Mark Addison wrote:
> On Wed, 2005-04-13 at 11:15 -0700, d. Taylor Singletary wrote:
> <snip>
> > my @vendors =
> > Conquent::Parser::express::DBI::VendorCat->search(catid=>$catid,
> > { order_by=>'vndrid->busname' }); 
> > 
> > But that doesn't seem to me that it would work. Is it possible to do
> > this with the order_by argument? Or should I just sort it after I've
> > filled the array?
> 
> You won't be able to use the order_by argument as you will need to use a
> join or sub-query to do the sort in sql. If you will only be getting a
> small list back the easiest thing would be to sort the array.
> If you want to do it in the database you will will need to create a
> custom sql query with the join to do the sort. See the docs for
> set_sql() and friends.
> 
> mark
> --
> 
> 
> 
> This email (and any attachments) is intended solely for the individual(s) to whom addressed. 
> It may contain confidential and/or legally privileged information. 
> Any statement or opinions therein are not necessarily those of ITN unless specifically stated. 
> Any unauthorised use, disclosure or copying is prohibited. 
> If you have received this email in error, please notify the sender and delete it from your system. 
> Security and reliability of the e-mail and attachments are not guaranteed. 
> You must take full responsibility for virus checking.
> 
> 
> 
> Independent Television News Limited, 
> 
> Registered No. 548648 England,
> 
> VAT Reg. No: GB 756 2995 81, 
> 
> 200 Gray's Inn Road, London WC1X 8XZ,
> 
> Telephone: 020 7833 3000.

Order By using related objects
d. Taylor Singletary 18:15 on 13 Apr 2005

Re: Order By using related objects
Mark Addison 18:31 on 13 Apr 2005

Re: Order By using related objects
d. Taylor Singletary 19:23 on 13 Apr 2005

Generated at 12:49 on 16 Apr 2005 by mariachi v0.52