-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sergio Rinaudo wrote:
> Hi,
> Thank you for your reply.
> Unfortunatelly I already know and use the array you talking about.
> 
> My problem is that my subquery is a join between 7 or 8 tables,
> and that array is something like 
> 
>  array('COUNT(*) AS number')
> 
> but zend framework's select object adds tablename.* for each table
> I've joined in my query, for example, my query become something like
> 
> SELECT COUNT(*) AS number, table1.*, table2.*, [...] tableN
> 
> And I get an error.
> How to tell zend select to not add those fields?

The second argument that you can pass to from() also applies to join*(),
except as the third argument. (Side note: you can use an associative
array instead of the "AS" keyword).

$db->select()->from('table1', array('number' => 'COUNT(*)'))
   ->joinInner('table2', 'table1.id = table2.table1_id', array())
   ...

If this is not what you mean, maybe you could post a code snippet to
help us understand.

- --

Brenton Alker
PHP Developer - Brisbane, Australia

http://blog.tekerson.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpnoMwACgkQ7bkAtAithusSNQCgq4Id0o1jBMm4KuMWQ/PgVtaJ
HL4An1DAPy+OkB9c783elqFDWTkzY5H0
=UMnK
-----END PGP SIGNATURE-----

Reply via email to