category
related products
SELECT TOP 5 LOGICALREF,CODE,NAME3 FROM LG_003_ITEMS IT WHERE LOGICALREF IN (SELECT ITEMREF FROM LG_003_ITEMCATEGORYLINE WHERE ITEMCATEGORYREF=( SELECT TOP 1 ITEMCATEGORYREF FROM LG_003_ITEMCATEGORYLINE WHERE ITEMREF=24317)) AND ACTIVE=0 ORDER BY (SELECT ISNULL(SUM(SALES_AMOUNT),0) FROM LV_003_12_STINVENS WHERE STOCKREF=IT.LOGICALREF AND INVENNO=-1) DESC