Önce Forum kurallarına uyunuz ;
aşağıdaki sorgu işinizi görecektir .
SELECT ITM.NAME,ITM.CODE,SUM(ST.AMOUNT),CONVERT(VARCHAR,ST.DATE_,104)
FROM LG_013_ITEMS ITM LEFT JOIN
LG_013_01_STLINE ST ON ST.STOCKREF=ITM.LOGICALREF
WHERE ST.BILLED=1 AND ((ST.DATE_ >= '1-1-2013')) AND (ST.DATE_ <='1-5-2013') AND (ST.CANCELLED = 0) AND ST.TRCODE IN (1,2,3,4,5,6,7,8,9)
GROUP BY ITM.NAME,ITM.CODE,ST.AMOUNT,ST.DATE_
ORDER BY ST.DATE_ ASC
------------------------------------------------------------------ aLTERNATİF
SELECT STRNS.AMOUNT, STRNS.PRICE, ITMSC.NAME, ITMSC.CODE,STFIC.DATE_
FROM LG_013_01_STLINE STRNS WITH(NOLOCK) LEFT OUTER JOIN LG_013_01_STFICHE STFIC WITH(NOLOCK) ON (STRNS.STFICHEREF = STFIC.LOGICALREF) LEFT OUTER JOIN LG_013_ITEMS ITMSC WITH(NOLOCK) ON (STRNS.STOCKREF = ITMSC.LOGICALREF)
WHERE (STRNS.SOURCEINDEX IN (0,1)) AND ((STFIC.DATE_ >= CONVERT(dateTime, '1-1-2013', 101)) AND (STFIC.DATE_ <= CONVERT(dateTime, '1-5-2013', 101))) AND (STFIC.CANCELLED = 0) AND STFIC.TRCODE IN (1,2,3,4,5,6,7,8,9)
ORDER BY ITMSC.CODE, STFIC.DATE_