So I have the following MySQL query, which works fine:
select
year(created_at) as year,
month(created_at) as month,
day(created_at) as day,
item_sdb_id,
price_per_unit
from
(select
l.item_sdb_id,
l.list_price / l.quantity as price_per_unit,
l.created_at from listings as l
inner join
purchases as p on
l.purchase_id = p.id
where l.item_sdb_id in (12345)
and p.created_at > '2013-07-09')
as t1
group by year, month, day
The problem is that instead of generating a price per unit of one item (12345 in this example) for each year, month, and day, I now want to sum the "list price/quantity" for a number of items (12345, 45278, 00154...), rendering a combined value of list prices/quantity per day, to essentially generate a daily index. I've come this far, but can't seem to make the next step -