Jim Scherer wrote:
I don't have the answer you seek, but maybe this can help get you on your
way. If you:

Thanks for your reply.
echo $select->__toString();

That sure helps. I can at least see what query is being generated.
You will see:

SELECT `s`.`sid`, `s`.`name`, `s`.`status`, `r`.`rid`, `r`.`rdate`, `sc`.*,
`c`.`name` FROM `student` AS `s` INNER JOIN `registration` AS `r` ON s.sid =
r.sid INNER JOIN `student_course_interests` AS `sc` ON s.sid = sc.sid INNER
JOIN `course` AS `c` ON c.cid = sc.cid

the SQL that is being generated for you. You can place this after any
$select statement to see step by step generated code.  You also have the
option of passing your select statement like this:

$select = $db->query('select s.sid, s.name, r.rid, r.rdate, c.name, s.status
from student as s, registration as r, student_course_interests as sc, course as c where s.sid=r.sid and s.sid=sc.sid and c.cid=sc.cid');

$result = $select->fetchAll();

I had tried this before. It changes the positions of the columns and the some columns are missing in the result.

I hope a Zend_DB expert will chime. :)
That's the best I can offer for now. Others surely know a lot more then I.
Jim
Regards,
Sudheer

Reply via email to