Hi,
There is not a lot to go on here, but a couple of hints for you to try.
Try declaring the filtered parameters into a temp table. This will not only help you with testing where you can display the result set, but you can also then select from it later on.
DECLARE @Params TABLE(family_description NVARCHAR(100),family_code NVARCHAR(20))
INSERT INTO @Params
SELECT DISTINCT family_description,family_code
FROM dim_item item
ORDER BY family_description
Your WHERE clause should be something more like this, which gives you a distinct list of family codes.
WHERE sales.oe_branch_code IN (@Branch)
AND item.family_code IN (SELECT DISTINCT family_code FROM @Params)
Gavin Clayton Claytabase Ltd www.claytabase.co.uk
No comments:
Post a Comment