On Thu, 28 Feb 2008, Alex Povolotsky wrote:
Hello!
I have a table of allowed IP addresses, table of physical servers and table
of virtual servers (jails).
Selection of allowed-and-unused IPs looks like
select * from our_ips where ipid not in (select ipid from server) and ipid
not in (select ipid from jail);
What's the best way to do it with DBIx::Class?
By moving it into a join instead?
I assume you have a has_many or has_one rel from "our_ips" to "server", so
does this do the same?
select * from our_ips me left join server server on me.ipid = server.ipid
where server.ipid is NULL
?
If so, make a has_* rel that forces left_join, and just have:
{ 'server.ipid' => undef }
in the where condition. Ditto for the other table.
Jess
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]