[Dbix-class] join another ResultSet
Spevak, Martin (HPES Network Management Solutions)
martin.spevak at hp.com
Thu May 29 14:55:08 GMT 2014
Hi all,
I need to join values from another ResultSet. Do you have any ideas if
it's possible?
For instance:
$res1 = $db->resultset('Table1')->search({ complex condition }, { join
=> [ with other tables ] });
table1 has column "id" and what I need are all rows from Table2 where
"Table2.column_name" = "id". I can do it next way:
$res2 = $db->resultset('Table2')->search({
column_name => { IN => $res1->get_column('id')->as_query },
});
but it's too slow. Using explain plan is better way to make next join
select * from table2 join ($res1->as_query) r1 on
(table2.column_name=r1.id);
It's possible to do it in DBIx?
--
Martin (singer) Spevak
HPES Software Development Engineer
HPES Network Management Solutions
Location: Galvaniho 7A, Bratislava, Slovakia
Tel: +421 2 5752 5574
Email: martin.spevak at hp.com
Out of Office Alert: 9-13.6
More information about the DBIx-Class
mailing list