Re: [CDBI] Help with multiple OR's.
"Bradley C Bailey" <[email protected]> Tue, 31 Jul 2007 10:18:11 -0600 (MDT)
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
> Hi,
>
> This is the query I'd like to perform.
>
> SELECT * FROM foo WHERE enabled = 1 AND (desc = foo or name = foo)
> AND (country = 1 or province = 9)
>
> I'm trying to build up a $criteria hash to do so.
>
> The problem I'm running to is the -or under the -and is a hash key
> and of course has to be unique. So I can't make 2..
>
> Anyone have suggestions ?
Try this:
$query = {
enabled => 1,
-and => [
[ desc => "foo", name => "foo" ],
[ country => 1, province => 9 ],
],
}
Regards,
Bradley C Bailey