>
> Sorry, sometimes you get so deep into something you forget everyone else 
> isn't familiar with the problem.
>

As an example, here's what I'm looking for:

select things.id, count(comments.type) from things things, comments comments
where things.creation >= "2015-04-19" and things.creation < "2015-04-26" 
and comments.target_id = things.id
and comments.type = 5
and comments.creation >= "2015-04-19" and comments.creation < "2015-04-26"
group by things.id
order by count(comments.type) desc; 

This gives the "desired" result of:

+----------+----------------------+
| id       | count(comments.type) |
+----------+----------------------+
| 20000181 |                   30 |
| 20000182 |                   28 |
| 20000183 |                   26 |
| 20000184 |                   24 |
| 20000185 |                   22 |
| 20000186 |                   20 |
| 20000187 |                   18 |
| 20000188 |                   16 |
| 20000189 |                   14 |
| 20000190 |                   12 |
| 20000191 |                   10 |
| 20000192 |                    8 |
| 20000193 |                    6 |
| 20000194 |                    4 |
| 20000195 |                    2 |
+----------+----------------------+
15 rows in set (0.00 sec)


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to