Steve,<br><br>I&#39;m not sure, but you may not need a &quot;join&quot; to do what you&#39;re asking to do.<br><br><div><span class="gmail_quote">On 11/4/07, <b class="gmail_sendername">Steve H</b> &lt;<a href="mailto:s_t_e_v_e_h@hotmail.com">
s_t_e_v_e_h@hotmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Hi again<br>(BTW, Andrew, thanks for your last help... I&#39;ve been busy working with it and distracted by my next stumbling block).
<br>I&#39;ve been puzzling over the manual and examples for how to express a simple join... I can&#39;t make sense of the Doxory example, for example, relating it to my simple context/example below.<br>I seem to be losing the plot with where/whether Alias&#39;s are required, where Type comes into it, why/where &#39;main&#39; is used in various examples (although I&#39;ve seen that Jifty appears to use &#39;main&#39; as a default alias), etc, etc,&nbsp;&nbsp;...I&#39;ve tried many, many combinations, resulting in errors (from bin/jifty server)&nbsp;&nbsp;ranging from &quot;Unsatisfied dependency chain in joins&quot; through to garbled SQL being generated (that fails &#39;prepare&#39;).&nbsp;&nbsp;Although I&#39;ve been hand-coding SQL for years... I don&#39;t seem to be getting the hang of this abstraction from the Jifty docs sans examples.
<br>I created a simple app to indicate the issue per below.&nbsp;&nbsp;Some (code) fragments include:<br><br>sqlite3 DB, created via Jifty:<br>CREATE TABLE order_hdrs (<br>&nbsp;&nbsp;id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL&nbsp;&nbsp;,<br>&nbsp;&nbsp;oh_deliv_addr text
<br>);<br>CREATE TABLE order_lines (<br>&nbsp;&nbsp;id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL&nbsp;&nbsp;,<br>&nbsp;&nbsp;ol_oh_pk integer&nbsp;&nbsp; ,<br>&nbsp;&nbsp;ol_descr text&nbsp;&nbsp; ,<br>&nbsp;&nbsp;ol_qty integer<br>);<br><br>Example of a simple SQL join:<br>sqlite&gt; select oh_deliv_addr, ol_descr, ol_qty from order_hdrs oh, order_lines ol where 
<a href="http://ol.id">ol.id</a> = <a href="http://oh.id">oh.id</a>;<br>deliv addr1|descr1 for deliv1|1<br>deliv addr2|descr2 for deliv1|2</blockquote><div><br>You should be able to just iterate over order lines:<br><br>my $order_lines = MyTest::Model::OrderLineCollection-&gt;new;
<br># Add any limits you want here...<br>while (my $order_line = $order_lines-&gt;next) {<br>&nbsp;&nbsp;&nbsp; Jifty-&gt;web-&gt;out(join(&#39; : &#39;, $order_line-&gt;ol_oh_pk-&gt;oh_deliv_addr, $order_line-&gt;ol_descr, $order_line-&gt;ol_qtr), &quot;\n&quot;);
<br>}<br><br>You could use a join to do this, but your test case makes it appear that just this code should do the job.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Example of a template/index.html to display via:<br>&nbsp;&nbsp;ol_descr&nbsp;&nbsp; ol_qty<br>% }<br><br>&lt;/&amp;&gt;<br><br>The Models used for this example include:<br>==&gt; Model/OrderHdr.pm &lt;==<br>use strict;<br>use warnings;<br>package MyTest::Model::OrderHdr;
<br>use Jifty::DBI::Schema;<br>use MyTest::Record schema {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;column oh_deliv_addr =&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type is &#39;text&#39;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;label is &#39;Delivery Address&#39;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is mandatory,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;render_as &#39;Textarea&#39;;<br>};<br># Your model-specific methods go here.<br>1;<br><br>==&gt; Model/OrderLine.pm &lt;==<br>use strict;<br>use warnings;<br>package MyTest::Model::OrderLine;<br>use Jifty::DBI::Schema;
<br>use MyTest::Record schema {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;column ol_oh_pk =&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type is &#39;integer&#39;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;label is &#39;OrdrHdr PK&#39;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;refers_to MyTest::Model::OrderHdr by &#39;id&#39;;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;column ol_descr =&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type is &#39;text&#39;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;label is &#39;Descr&#39;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;column ol_qty =&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type is &#39;integer&#39;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;label is &#39;Qty&#39;;
<br>};<br># Your model-specific methods go here.<br>1;<br><br><br><br>_________________________________________________________________<br>Your Future Starts Here. Dream it? Then be it! Find it at <a href="http://www.seek.com.au">
www.seek.com.au</a><br><a href="http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2F%3Ftracking%3Dsk%3Ahet%3Ask%3Anine%3A0%3Ahot%3Atext&amp;_t=764565661&amp;_r=OCT07_endtext_Future&amp;_m=EXT_______________________________________________">
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2F%3Ftracking%3Dsk%3Ahet%3Ask%3Anine%3A0%3Ahot%3Atext&amp;_t=764565661&amp;_r=OCT07_endtext_Future&amp;_m=EXT_______________________________________________
</a><br>jifty-devel mailing list<br><a href="mailto:jifty-devel@lists.jifty.org">jifty-devel@lists.jifty.org</a><br><a href="http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel">http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
</a><br></blockquote></div><br>