使用DBIx :: Class中的ID列表进行搜索

时间:2011-08-10 13:40:53

标签: perl dbix-class

我有一个列表,其中包含用户选择的ID。 在DBIx :: Class ??

中使用此ID列表搜索所有行的最佳方法是什么

1 个答案:

答案 0 :(得分:4)

使用

$rs->search({ 
    whatever_the_column_is => { 
        '=' => [ @a_bunch_of_ids ]
    }
})

$rs->search({
    whatever_the_column_is => {
       -in => [ @a_bunch_of_ids ]
    }
})

如果您的数据库更喜欢IN次查询。两者都记录在SQL::Abstract docs

相关问题