<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I am resurrecting this tread...<div><br></div><div>So, and maybe this is obvious &nbsp;- can you define a define two relationships&nbsp;to&nbsp;the&nbsp;same&nbsp;table&nbsp;(both,&nbsp;for&nbsp;example,&nbsp;&nbsp;'belongs_to' or 'has_many' as schema suggests), but with different join_types?</div><div><br></div><div>I can't see why not, but I would hate to go down this path and get creamed.</div><div><br></div><div>I think then the solution to original problem would be a where clause something like&nbsp;</div><div>"where book.user_id = 'givenuser' or book.user_id is null"</div><div><br></div><div>Ben</div><div><div><div><div><br></div><div><br></div><div><br></div><blockquote type="cite"><div dir="ltr">May be smth like:<br><br>$c-&gt;model('DB::Book')-&gt;search({ 'bookuser.user_id' =&gt; givenuser},{<br>&nbsp;&nbsp; join =&gt; 'bookuser'<br>});<br><br>where the 'bookuser' is the relationship defined like:<br> <br>Book-&gt;belongs_to(<br>&nbsp; "bookuser",<br>&nbsp; "User",<br>&nbsp; { id =&gt; "user_id" },<br>&nbsp; { join_type =&gt; "LEFT OUTER" },<br>);<br><br>?<br><br>Sorry for "draftness", I just copied samples from my code.<br> <br><div class="gmail_quote">On Tue, Oct 14, 2008 at 8:51 PM, Jason Gottshall <span dir="ltr">&lt;<a href="mailto:jgottshall@capwiz.com">jgottshall@capwiz.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div class="Ih2E3d">Jason Gottshall wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> SELECT book.*, book_user.*<br> FROM book<br> LEFT OUTER JOIN book_user<br> &nbsp;ON ( &nbsp; &nbsp;book_user.book_id = book.book_id<br> &nbsp; &nbsp; &nbsp;AND book.user_id &nbsp; &nbsp; &nbsp;= 'givenuser'<br> &nbsp;)<br> </blockquote> <br></div><div class="Ih2E3d"> michael reddick wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> The and "book.user_id = 'giveruser'" doesn't have to be in the ON statement does it? You could just put it into the where clause and it should work the same.<br> </blockquote> <br></div> Yeah, that's the first thing I tried, but it didn't work (on Oracle, anyway.) When I move the explicit criteria to the WHERE clause, I seem to lose the left-outer-ness of the join, and I only get back books for which the book_user table has a record. I'm stumped. Anyone else?<br> <font color="#888888"> <br> Jason</font><div><div></div><div class="Wj3C7c"><br> <br> <br> _______________________________________________<br> List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class</a><br> IRC: <a href="http://irc.perl.org#dbix-class" target="_blank">irc.perl.org#dbix-class</a><br> SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/" target="_blank">http://dev.catalyst.perl.org/repos/bast/DBIx-Class/</a><br> Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" target="_blank">http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk</a><br> </div></div></blockquote></div><br></div> _______________________________________________<br>List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class</a><br>IRC: irc.perl.org#dbix-class<br>SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/">http://dev.catalyst.perl.org/repos/bast/DBIx-Class/</a><br>Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk">http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk</a></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>--</div><div>Ben Hitz&nbsp;</div><div>Senior Scientific Programmer ** Saccharomyces Genome Database ** GO Consortium</div><div>Stanford University ** <a href="mailto:hitz@genome.stanford.edu">hitz@genome.stanford.edu</a></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span></span></span></div></span> </div><br></div></div></body></html>