Why this SQL procedure gives contiguous repeated records ( 3 or 4 times ) ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ALTER PROCEDUREGetProductsOnPromotInDep
(@.DepartmentIDINT)
AS
SELECT Product.ProductID, Title
FROMProductINNER JOIN
(ProductCategoryINNER JOIN
(CategoryINNER JOINDepartment ONDepartment.DepartmentID = Category.DepartmentID)
ONProductCategory.CategoryID = Category.CategoryID)
ONProduct.ProductID = ProductCategory.ProductID
WHERECategory.DepartmentID = @.DepartmentID
ANDProductCategory.CategoryID = Category.CategoryID
ANDProduct.ProductID = ProductCategory.ProductID
ANDProduct.OnPromotion = 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Maybe you could slap thedistinct keyword in there.
With out seeing the data...it may be the multiple results are from multiple categories in a department, or multiple departments in a category.
|||Thank you, Steve.
No comments:
Post a Comment