> I've got some basic SQL knowledge, decent Rails knowledge and good PHP
> knowledge... But your SQL queries in admin_controller.rb are WAY too
> advanced for me!
Don't get too scared of the big SQL statements. They are easily
ported to MySQL using the notes provided in the source code.
> Can you give us the abstracted (SQL-independent) way to do this, with
> no SQL? I don't really care about the performance loss, since I'm the
> only one that every going to feel it (it's an Admin interface, after
To do it without the SQL statements, ActiveRecord will have to fetch
every row from the orders and the line_items table for all orders in
the last one year period, one row at a time. When you get a decent
amount of orders in the system, you'll have to wait tens of seconds
(if not minutes, depending on your system) for the admin page to
load. Can you guess why I know this? :)
> Or could you translate it into MySQL?
Well, give it a go first. If you can't get it to work, get back to me.
> My web host doesn't support PostgreSQL...
Sorry about that.
Potion Factory LLC