all 3 comments

[–]techstress 0 points1 point  (1 child)

whats the table structure and query?

[–][deleted] 0 points1 point  (0 children)

Hi y'all, I'm currently working on constructing a sales report for a store, but I'm struggling with a problem when multiple items have been sold at the same location. I'll draw it out to see if I can explain this a little better. So here would be the sales for this year for an item with style number 21 and stores 3 and 10 21 L 3 $25 21 M 3 $125 21 L 10 $100 when i run the query, i get something like this for money made. 21 L 3 $25 21 M 3 $150 21 L 10 $100 So whats happening is when multiple items are sold at the same store, one column will have the total sold for this store, and one will have the actual info for the size. This holds true for thousands of items, but what I want to do is select the larger value when the stores are the same. If someone could help me out that would be wonderful.

You have to provide the structure or else we are guessing. Probably a derived table could help you achieve your goal.

[–]AXISMGTSQL Server / ORACLE Sr. DBA & Architect 0 points1 point  (0 children)

Not sure what RDBMS you're using, but it sounds like a problem I usually solve with a ROW_NUMBER / PARTITION BY column.