Hi there, I'm using Open Flash Chart to create a pie chart of user's
categorized spending.  It currently includes only categories that I
have in my Category model, but does not include "uncategorized"
entries which have no association in the entry_categories table.

I'd like to include those entries that are not categorized as well in
my grouping so that I can display them in the pie chart as
"uncategorized."  How would i do that?  Below is the SQL that
successfully grabs categorized entries.  How would i retrieve and
group uncategorized entries as part of this query?

@entries = Entry.find_by_sql ["SELECT sum(entries.price) AS
sum_price,
categories.name AS category_name, categories.color AS category_color
      FROM entries, categories, entry_categories
      WHERE entries.user_id = ? AND entries.id =
entry_categories.entry_id and entry_categories.category_id =
categories.id
      GROUP BY categories.id", current_user.id]

Thanks in advance.
-A
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to