[Dbix-class] how to build this query? col1 not like "%xx%" AND
col1 like "%yy%"
Paul Findlay
Paul.Findlay at fonterra.com
Wed Mar 20 01:26:28 GMT 2013
Hi Rajeev,
Not sure what you have tried, but this should work:
my $rs_1 = $rs->search({
col1 => { -not_like => "%xx%", -like => "%yy%" }
});
Then to do extra searches on the result set, just call search again.
my $rs_2 = $rs_1->search({ col1 => { -not_like => '%zz%" }});
Documentation for chaining resultsets: https://metacpan.org/module/DBIx::Class::ResultSet#Chaining-resultsets
And on where clauses, look at the SQL::Abstract documentation:
"The main logic of this module is that things in arrays are OR'ed, and things in hashes are AND'ed."
https://metacpan.org/module/SQL::Abstract#WHERE-CLAUSES
- Paul
DISCLAIMER
This email contains information that is confidential and which may be legally privileged. If you have received this email in error, please notify the sender immediately and delete the email. This email is intended solely for the use of the intended recipient and you may not use or disclose this email in any way.
More information about the DBIx-Class
mailing list