Yeh this is DBIx :-) .. 

Thank you 

On Tue, 14 Dec 2010 13:37:47
-0200, Hernan Lopes  wrote:  

Thats DBIx::Class question and not a
catalyst question.
here are dbix class docs:
http://search.cpan.org/~frew/DBIx-Class-0.08124/ [1] 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 
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:
[email protected] [3]
 Listinfo:
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst [4]

Searchable archive:
http://www.mail-archive.com/[email protected]/ [5]
 Dev site:
http://dev.catalyst.perl.org/ [6]

-- 

Vivek Chhikara [7]



Links:
------
[1] http://search.cpan.org/~frew/DBIx-Class-0.08124/
[2]
mailto:[email protected]
[3] mailto:[email protected]
[4]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
[5]
http://www.mail-archive.com/[email protected]/
[6]
http://dev.catalyst.perl.org/
[7] http://www.chhikara.org/wordpress
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to