Sorry, I've changed the code since which now works for me. The answer was to use an associative array. I was given the answer here; http://stackoverflow.com/questions/19855238/how-do-i-use-aggregate-functions-in-zend-db-sql
Steve On Fri, Nov 8, 2013 at 9:07 AM, Steve Rayner <[email protected]>wrote: > I'm getting Object of class Zend\Db\Sql\Expression could not be converted > to string with the following code; > > > $select->join(*array*('tt' => 'discuss_thread_tag'), > > 'tt.tag_id = discuss_tag.tag_id', > > *array*(), > > 'left') > > ->join(*array*('t' => 'discuss_thread'), > > 't.thread_id = tt.thread_id', > > *array*(*new *Expression('COUNT(thread_id) AS thread_count')), > > 'left') > > ->join(*array*('m' => 'discuss_message'), > > 'm.thread_id = t.thread_id', > > *array*(*new *Expression('MAX(post_time) AS last_post')), > > //'*', > > 'left') > > ->group(*array*('discuss_tag.name', 'discuss_tag.slug', > 'discuss_tag.description')); > > seems ok if i remove the expressions. > > what am i doing wrong? > > >
