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@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/