Thats DBIx::Class question and not a catalyst question.
here are dbix class docs:
http://search.cpan.org/~frew/DBIx-Class-0.08124/everything you need is
there. Take a look at joining at the bottom of the
page.

--Hernan

On Tue, Dec 14, 2010 at 1:27 PM, Vivek Chhikara <vi...@chhikara.org> wrote:

>
>
> I am new to catalyst and need guidance in fetching some data from my mysql
> db.
>
> I want to know how can I write below queries(1&2)
>
> Here is dummy table structure I am using.
> -------------------------------------------------
>         table1
>         =======
>         qid  sid status name
>         __PACKAGE__->set_primary_key("qid");
>         __PACKAGE__->belongs_to("queq_dump",
> 'MYAPP::Schema::Result::Table2, {qid => 'qid'});
>
> -------------------------------------------------
>         table2
>         pid eid qid name
>         primary_key == pid+qid+eid
> -------------------------------------------------
>
>     QUERY 1
>     =======
>     select A.qid, A.name, A.name from table1 A, table2 B
>     where
>          A.qid = B.qid
>     and  A.sid = 1
>     and  B.pid != 2
>
>     QUERY 2
>     =======
>     select A.qid, A.name, A.name from table1 A, table2 B
>     where
>         A.qid = B.qid and B.eid = (select min(eid) from table2 where
> table2.status = 1)
>
> _______________________________________________
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to