UltraSmooth
Programmer
I'm having some problems coming up with a "Top N Of Group" query. I've googled it as well as gone through this forum but cannot come up with anything that works. Here's my situation, hopefully someone might have some tips to point me in the right direction.
I have 3 tables needed in the query.
An item header table, SYINVHDR, which contains an item number and category information (what I want to group by).
An item detail table, SYINVDTL, which contains details such as colour,size,width, location and price/cost information.
A sales table, SYINVHIS, that contains a weekly sales summary record for each item by item/location.
I need to join the three tables as I need the category from syinvhdr (group by), syinvhdr joins to syinvdtl on item to get the details such as colour,size etc. and then this joins to syinvhis to get the sales for the item for a particular week.
What i would like to get is the top N selling items for each category for a specified date.
Anyone have any suggestions on how to go about his?
I have 3 tables needed in the query.
An item header table, SYINVHDR, which contains an item number and category information (what I want to group by).
An item detail table, SYINVDTL, which contains details such as colour,size,width, location and price/cost information.
A sales table, SYINVHIS, that contains a weekly sales summary record for each item by item/location.
I need to join the three tables as I need the category from syinvhdr (group by), syinvhdr joins to syinvdtl on item to get the details such as colour,size etc. and then this joins to syinvhis to get the sales for the item for a particular week.
What i would like to get is the top N selling items for each category for a specified date.
Anyone have any suggestions on how to go about his?