Hi all,

I have a table 'sample' with two columns: course_id and student_id.

It is a many-to-many relationship table between Course and Students.

Now I am facing a problem with Doctrine_Query. I am able to run this query
in mysql prompt.

select(course_id as cid,count(*) from sample where course_id in (select
s.course_id from sample s where s.student_id = 1) group by(student_id);

To convert in DQL,

$query = Doctrine_Query::create()
             ->select('s.course_id as cid,count(*) as num')
             ->from('Sample s')
             ->where('s.course_id IN (select t.course_id from Sample t where
t.student_id = ?)',1)
             ->groupBy('s.course_id');

$rows = $query->fetchArray();


This Query is always returning a single row, though I am getting many rows
from mysql query.

-- 
Thanks & Regards,

Murali Krishna.B,

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to