UPDATE : the precise query that i need to use is 

SELECT pages.*
FROM pages
INNER JOIN (
   SELECT pg.page_id as page_id , SUM(pg.quantity) AS total 
   FROM page_guest AS pg
   GROUP BY pg.page_id
   ORDER BY total DESC
) t
ON (pages.id=t.page_id)




Em quarta-feira, 3 de agosto de 2016 12:24:31 UTC-3, Albert R. Carnier 
Guedes escreveu:
>
>  Hi people
>
> I have 3 table where in one table ( 'guests' ) i have registred ips of 
> users guests from a site, in other table ( 'pages' ) i registred the pages 
> of the site, and in other table ( 'page_guest' ), i registred how much and 
> how page viewest by the the user. 
>
> So, i need to translate this query to DQL:
>
>
> SELECT mostviewed.page_id FROM (
>    SELECT pg.page_id as page_id , SUM(pg.quantity) AS total 
>    FROM page_guest AS pg
>    GROUP BY pg.page_id
>    ORDER BY total DESC
> ) AS mostviewed;
>
>
>
>
> Specifically , i need retrieve the entire page entity not only 'page_id' 
> and not the 'total' of views. The 'total' is used only to sort the most 
> viewest pages.
>
> I try to use the subqueries tecniques of doctrine 2 but always has errors. 
> Because this i ask a hint of how to do it right.
>
>
> Thank you in advance.
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to