Thursday, March 8, 2012

Assigning a Text Variable

Here's what I've got:

select sum(item_price) as item_price, sum(item_qty) as item_qty, avg (item_price) / avg(item_qty) as average_price from x_invoic

where item_code = (item from a different table)
and status = 9

The "item from a different table" are items that I'm interesting in compiling this data for. I'm not sure what the best way to "cycle" through these items is but I would like to get data on each one of them. I was thinking of using a variable, if possible, but I'll do whatever works.

Any input is appreciated.

Regards,
TechRickUse IN and GROUP BY|||Originally posted by jzhu
Use IN and GROUP BY

Thanks!

No comments:

Post a Comment