Cool here is my models and I posted an sql query to:

Models
http://dpaste.com/32548/

SQL Queries (posted a question in this one)
http://dpaste.com/32552/

Hope this helps. maybe there is a better way of doing what I am trying
to do.

Thanks for helping.


On Jan 25, 12:59 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> On Jan 25, 12:42 pm, Chris <[EMAIL PROTECTED]> wrote:
>
> > Thanks for reply but that is not what I am looking to do. my [EMAIL 
> > PROTECTED] table
> > is NOT the categories table.
>
> Well, as I said in my earlier post, you still haven't posted your
> model code. It would help people understand better what you are trying
> to do.
>
> > In django, when it generates your models,
> > it automatically generates your M2M table reference. so I have a table
> > called blog that has a m2m relation with categories. 
> > (blog-->M2M-->categories) Right! Ok so using distinct on the category table 
> > would
>
> > NOT work since they would already be distinct. The table that I need
> > to grab results from is the M2M table NOT categories.  Make sense?
>
> Not really.
>
> You said previously that you needed to count the number of blogs for a
> given category ('politics'). The query I mentioned originally, does
> that. Incidentally, the distinct() in my query is on the Blog model
> and not on the Category model.
>
> You don't need to grab results directly from the automatically
> generated M2M table to get the count you are interested in. You could,
> of course, fetch results directly from the M2M table using custom sql
> but it's not necessary unless you want to do something other than what
> you say you want to do :) In that case, please consider posting your
> model.
>
> Cheers,
> -Rajesh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to