0

I'm having a rough time figuring out where to start with getting this query into a Zend_Db_Select. I have never worked with 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;
1
  • If it is not needed, maybe use a $db->query(). You could also create a view in your database and make a model for it. I think it would be faster and more efficient than using Db_select. Commented Feb 16, 2011 at 11:35

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.