我如何用 DBIx:Class 做 WHERE ‘OR’ 和 “AND’?
How do I do WHERE ‘OR’ and “AND’ with DBIx:Class?
如何使用 DBIx::Class 搜索或查找进行等效操作?
SELECT *
FROM `person`
WHERE ( `name` = 'doug' OR `nickname` = 'doug' ) AND `age` = 50;
我已经搜索了文档,但似乎无法解决。我尝试了以下方法,但无法正常工作。
my $result = $db->resultset('person')->find(
{ [ { name => 'doug', nickname => 'doug' } ] , age => 50 }
)};
好的,我想我已经解决了
my $ingress = $db->resultset('person')->search(
{ -and => [
-or => [
name => 'doug' ,
nickname => 'doug' ],
age => 50 ] },
如何使用 DBIx::Class 搜索或查找进行等效操作?
SELECT *
FROM `person`
WHERE ( `name` = 'doug' OR `nickname` = 'doug' ) AND `age` = 50;
我已经搜索了文档,但似乎无法解决。我尝试了以下方法,但无法正常工作。
my $result = $db->resultset('person')->find(
{ [ { name => 'doug', nickname => 'doug' } ] , age => 50 }
)};
好的,我想我已经解决了
my $ingress = $db->resultset('person')->search(
{ -and => [
-or => [
name => 'doug' ,
nickname => 'doug' ],
age => 50 ] },