views:

32

answers:

0

Hi,

I am trying to add a field via a subselect but cant figure out how to format the subquery in Zend DB. E.g. in MySql it looks like this:

SELECT a.columnA, b.columnB,
**(SELECT c.columnC FROM tableC c WHERE c.test = 1) AS total**
FROM tableA AS a
INNER JOIN tableB on b.id = a.id

The Zend DB format is:

->select()
->from(array('a'=> tableA),array('columnA'))
->joinInner(array('b'=> tableB),array('columnB'))

Does anyone have any idea how i could add this subselect in??

Thanks

Paul