Complex sql query approach

Hi All,

I have a question about what would be the best or the “rails” way to
generate a report from my web app that is basically a web store. I
wonder if
I should just come up with a complex sql query by hand (which would
take a while to figure out since I don’t know much beyond basic sql,
haven’t delved into joins yet). Or should I just use my rails models and
attributes and do all the calculations in ruby (I fear this could this
entail a significant database hit).

Here is my data structure.

Artists has_many Releases has_many Products has_many LineItems has_many

I would like to generate a sales report that lists each artist with
associated releases and for each product associated with that release I
would like to list the number of copies sold and the total sales price.

Any opinions on the best way to approach this?

Thanks in advance,

On Thu, 2007-01-11 at 19:39 -0500, Sean O’Hara wrote:

Any opinions on the best way to approach this?

the find (complex searches)…

the view code - start hacking