SELECT UpSellProductID from UpSells where ProductID = #ProductID#
SELECT ProductID from UpSells where #ProductID# = UpSellProductID
SELECT a.*, c.categoryid, d.name, b.DiscountType, b.DiscountAmount,
b.DiscountEndDate, b.DiscountStartDate,
(select count(productid) from OptionName where OptionName.ProductID = a.ProductID) AS optionCount
FROM ((Products a LEFT JOIN Discounts b ON a.ProductID = b.ProductID)
INNER JOIN ProductsCategories c ON a.ProductID = c.ProductID)
INNER JOIN Categories d ON c.CategoryID = d.CategoryID
WHERE
a.productID in (#valueList(relatedItems.upSellProductID)#)
OR
a.productID in (#valueList(reverseRelatedItems.ProductID)#)