Le 13 novembre 2013 11:43, Christopher Crouzet <
[email protected]> a écrit :

> J'ai cru comprendre qu'avec UNION il fallait que les colonnes des 2 tables
> correspondent ? Ce qui n'est pas mon cas puisque j'essaye d'ajouter le
> nombre de views d'une table a cote du nombre de comments d'une autre table.
>

Au temps pour moi, j'ai mal "lu" ton mail html initial :)

c'est bien un join qu'il te faut. Un truc du genre :

SELECT C.post_id, DATE( C.comment_dt ) AS date, COUNT( C.comment_id ) as
nb_comment, PS.views
FROM dc_comment C
INNER JOIN dc_poststats PS on PS.post_id=C.post_id and PS.date=C.comment_dt
GROUP BY post_id, DATE( date )

?
-- 
Dev mailing list - [email protected] - http://ml.dotclear.org/listinfo/dev

Répondre à