Forum
SELECT DISTINCT TOP 10
ProductName AS URUNADI,
Quantity AS ADET,
SUM(Price*Quantity) AS TUTAR
FROM
Bill
WHERE Date > DATEADD(DAY,-1,GETDATE())
GROUP BY
ProductName,Quantity
ORDER BY
TUTAR DESC
Bu şekilde olan sorgumda ana stok kartı aynı olan ürünleri replace ederek listeledim fakat gruplayamadım. Son hali aşağıdaki gibi. Yardımcı olabilirseniz sevinirim.
SELECT DISTINCT TOP 10
LTRIM(RTRIM(PARSENAME(REPLACE(ProductName, '.', '.'), 2))) AS URUNADI,
Quantity AS ADET,
SUM(Price*Quantity) AS TUTAR
FROM
Bill
WHERE Date > DATEADD(DAY,-1,GETDATE())
GROUP BY
ProductName,Quantity
ORDER BY
TUTAR DESC
Merhaba,
aşağıdaki şekilde deneyebilirmisin?
SELECT DISTINCT TOP 10
LTRIM(RTRIM(PARSENAME(REPLACE(ProductName, '.', '.'), 2))) AS URUNADI,
SUM(Quantity) AS ADET,
SUM(Price*Quantity) AS TUTAR
FROM
Bill
WHERE Date > DATEADD(DAY,-1,GETDATE())
GROUP BY
ProductName,SUM(Quantity)
ORDER BY
TUTAR DESC