[Dbix-class] Right join
TAPO (Thomas Agersten Poulsen)
TAPO at novozymes.com
Fri Jan 27 11:51:14 CET 2006
Dear list,
Please excuse a possibly stupid question---I might be doing this all backwards.
I am doing a JOIN using DBIx::Class version 0.04999_04
to find the number of "requestedseqs" that has a "response":
$req->requestedseq()->search({},{join=>'response'})->count()
Here, requestedseq() returns a result-set on a table that has a has_many relation on the "response" table.
Setting DBIX_CLASS_STORAGE_DBI_DEBUG=1
I get
SELECT COUNT( * ) FROM requested_seqs me LEFT JOIN responses response ON ( response.requested_sequence = me.id ) WHERE ( ( ( request = ? ) ) ): 95
This gives me the number of elements in the requestedseq result-set, and that is not what I want.
The problem would be solved if I could change the "LEFT JOIN" to a "RIGHT JOIN" (or just a "JOIN") or put a "response.id IS NOT NULL" in the WHERE clause.
I anybody can give me a hint, I'll be most grateful!.
Best regards
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/dbix-class/attachments/20060127/5b2b8263/attachment.htm
More information about the Dbix-class
mailing list