have a table with style number field, a style description field, a INSTOCK ("Yes/No") field, and a qty field.
Some of the style numbers are unique, others appears many times in the table.
I want to be able to get a list of all the styles in the same manner I would do using SELECT DISTINCT, meaning one line per style and the sum of the qty for identical style in the table.
Up to that point I have no problem as I use something like:
Select STYLENO, sum(QTY) as SumOfQty, grouped by STYLENO
The catch is, whenever there are many identical styles, I have to return the STYLEDESC only where INSTOCK = "No". There could be one record with a "No" or many of them at any given point. But each styles has at least 1 record with INSTOCK = "No".
If there are many lines with a "No", it doesn't matter which one I pick, as long I pick one where INSTOCK = "No" to get the right description.
I hope I'm explaining this right.
Does anyone care to give it a shot?
TIA
Some of the style numbers are unique, others appears many times in the table.
I want to be able to get a list of all the styles in the same manner I would do using SELECT DISTINCT, meaning one line per style and the sum of the qty for identical style in the table.
Up to that point I have no problem as I use something like:
Select STYLENO, sum(QTY) as SumOfQty, grouped by STYLENO
The catch is, whenever there are many identical styles, I have to return the STYLEDESC only where INSTOCK = "No". There could be one record with a "No" or many of them at any given point. But each styles has at least 1 record with INSTOCK = "No".
If there are many lines with a "No", it doesn't matter which one I pick, as long I pick one where INSTOCK = "No" to get the right description.
I hope I'm explaining this right.
Does anyone care to give it a shot?
TIA