On Thu, 26 Mar 2009, Bolla Sandor wrote: > In rare cases I need to put subselects right after 'SELECT' keyword in > MySQL. > e.g: > > select x,y,(select z from b where id = a.id) as _b from a ... > > is there any support planned for this case?
You can do that like this already: $db = ezcDbInstance::get(); $q = $db->createSelectQuery(); $qs = $db->createSelectQuery(); $qs->select( 'z' )->from( 'b' )->where( $qs->expr->eq( 'id', 'a.id' ) ); $q->select( 'x', 'y', "($qs as _b)" )->from( 'a' ); echo $q->getQuery(), "\n"; > The original ezcQuerySelect->select() function could be enhanced to use > ezcQuerySubSelect object. > Needs class checking and getQuery functionality, maybe alias enhancement > as well. As for aliases, that's tricky to do... because the select query might look different and I'd have no idea how to set up such an alias in a nice way. If you have a good idea on how to implement that... we'd be interested. regards, -- Derick Rethans eZ components Product Manager eZ systems | http://ez.no -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components