[Catalyst] DBIx question
Will Smith
willbelair at yahoo.com
Fri Aug 24 17:02:39 GMT 2007
Thank you all,
it works.
Matt Lawrence <matt.lawrence at ymogen.net> wrote: Will Smith wrote:
> Hi, I know this is not the room for DBIx, I tried to post in DBIx, but
> did not go through, so, if you don't mind, please do not bounce me out.
> my question is:
> I have a multiple join, and trying to sort the dataset using oder_by,
> and get either error, or do not sort.
> my code is:
> # table: calls,property,city . property has many calls, city has
> many property, calls belong to property, property belong to city
> my $rs = [$c->model('myappDB::City')->search(
> {
> 'calls.CallerID' => '1',
> 'calls.CallStatusID' => '0'
> },
> {
> order_by => 'city.CityName'
> },
> {
> join => { 'property' => 'calls'
> }
> }
> )];
>
> How can I sort by CityName ?
>
> Thank you.
Looks like you have too many hashrefs there, and the city table is
called "me" because it's the main table you're searching in.
Try it like this:
my $rs = [$c->model('myappDB::City')->search(
{
'calls.CallerID' => '1',
'calls.CallStatusID' => '0'
},
{
order_by => 'me.CityName',
join => { 'property' => 'calls' },
}
)];
Matt
_______________________________________________
List: Catalyst at lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/
---------------------------------
Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070824/d38ecf41/attachment-0001.htm
More information about the Catalyst
mailing list