[CDBI] Re: Help with multiple OR's.
Jeff MacDonald <[email protected]> Tue, 31 Jul 2007 12:03:27 -0400
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
On 31-Jul-07, at 11:52 AM, Edward J. Sabol wrote: > Jeff MacDonald wrote: >> 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 ? > > You didn't say, but I presume you are asking about > Class::DBI::AbstractSearch. The solution to your problem is to use an > arrayref instead of a hashref. Refer to the SQL::Abstract > documentation for > more info: > > http://search.cpan.org/perldoc?SQL%3A%3AAbstract > > Hope this helps, > Ed I'm using the Class::DBI::Sweet page() method. ---- Jeff MacDonald Interchange Technologies 613 292 6239