开发者

Zend_Db_Select with variable assignment and subqueries

I'm having a rough time figuring out where to start with getting this query into a Zend_Db_Select. I have never worked wit开发者_运维问答h variables assignment and subqueries in Zend:

SELECT
    @current_continent := stats_geo_continent.id AS `continent_id`,
    (SELECT GROUP_CONCAT(code) from stats_geo_country WHERE stats_geo_country.continent = @current_continent) AS `group`,
    stats_geo_country.code
FROM
    stats_geo_continent
INNER JOIN
    stats_geo_country ON stats_geo_country.continent = stats_geo_continent.id;


I think it will be possible when you use Zend_Db_Expr for your variable assignments. For subgqueries you can use second Zend_Db_Select object as a part of main object - maybe that link will help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜