<p>Yeh this is DBIx :-) ..</p>
<p>Thank you</p>
<p>On Tue, 14 Dec 2010 13:37:47 -0200, Hernan Lopes &lt;hernanlopes@gmail.com&gt; wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<p>Thats DBIx::Class question and not a catalyst question.<br />here are dbix class docs: <a href="http://search.cpan.org/~frew/DBIx-Class-0.08124/">http://search.cpan.org/~frew/DBIx-Class-0.08124/</a> everything you need is there. Take a look at joining at the bottom of the page.<br /><br />--Hernan<br /><br /></p>
<div class="gmail_quote">On Tue, Dec 14, 2010 at 1:27 PM, Vivek Chhikara <span>&lt;<a href="mailto:vivek@chhikara.org">vivek@chhikara.org</a>&gt;</span> wrote:<br />
<blockquote class="gmail_quote" style="margin: 0pt  0pt  0pt  0.8ex; border-left: 1px  solid  #cccccc; padding-left: 1ex;">
<p><br /><br />I am new to catalyst and need guidance in fetching some data from my mysql db.<br /><br />I want to know how can I write below queries(1&amp;2)<br /><br /><span style="color: #0000ff;">Here is dummy table structure I am using. </span><br /><span style="color: #0000ff;">-------------------------------------------------</span><br /><span style="color: #0000ff;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;table1</span><br /><span style="color: #0000ff;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;=======</span><br /><span style="color: #0000ff;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;qid&nbsp; sid status name</span><br /><span style="color: #0000ff;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;__PACKAGE__-&gt;set_primary_key("qid");</span><br /><span style="color: #0000ff;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;__PACKAGE__-&gt;belongs_to("queq_dump", 'MYAPP::Schema::Result::Table2, {qid =&gt; 'qid'});</span><br /><br /><span style="color: #0000ff;">-------------------------------------------------</span><br /><span style="color: #0000ff;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;table2</span><br /><span style="color: #0000ff;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;pid eid qid name</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; primary_key == pid+qid+eid<br /><span style="color: #0000ff;">-------------------------------------------------</span><br /><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;QUERY 1</span><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;=======</span><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;select A.qid, A.name, A.name from table1 A, table2 B </span><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;where </span><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A.qid = B.qid </span><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;and&nbsp; A.sid = 1</span><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;and&nbsp; B.pid != 2</span><br /><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;QUERY 2</span><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;=======</span><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;select A.qid, A.name, A.name from table1 A, table2 B </span><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;where </span><br /><span style="color: #339966;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; A.qid = B.qid and B.eid = (select min(eid) from table2 where table2.status = 1)</span></p>
<br />_______________________________________________<br /> List: <a href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br /> Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br /> Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br /> Dev site: <a href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a><br /><br /></blockquote>
</div>
<br /></blockquote>
<p>&nbsp;</p>
<div>-- <br />
<pre><a href="http://www.chhikara.org/wordpress" target="_blank">Vivek Chhikara</a></pre>
</div>