2011-02-16 4 views
0

Zend_Db_Select에이 쿼리를 가져 오는 데 어디서부터 시작 해야할지 알 수 없습니다. 나는 젠드의 변수 할당 및 하위 쿼리와 함께 일한 적이있다 :Zend_Db_Select 변수 할당 및 하위 쿼리

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; 
+0

필요하지 않은 경우 $ db-> query()를 사용하십시오. 또한 데이터베이스에 뷰를 만들고 모델을 만들 수도 있습니다. Db_select를 사용하는 것보다 빠르고 효율적이라고 생각합니다. – Marcin

답변

1

나는 당신이 당신의 변수 할당에 대한 Zend_Db_Expr를 사용할 때 가능할 것이라 생각합니다. 하위 쿼리의 경우 보조 객체 Zend_Db_Select을 기본 객체의 일부로 사용할 수 있습니다. that link이 도움이됩니다.