Postingan lainnya
cara menghitung "nama barang" muncul berapa kali sesuai custid
saya membuat syntax seperti ini :
alter FUNCTION Production.TotalPembelian (@custid INT)
RETURNS TABLE AS
RETURN
SELECT custid AS ' Id Produk', pro.productid AS ' Id Produk',
FROM Production.Products as pro
JOIN Sales.OrderDetails as sup
on pro.productid = sup.productid
JOIN Sales.Orders as ord
on sup.orderid = ord.orderid
WHERE custid = @custid
GROUP BY custid,pro.productname
--GROUP BY pro.productname
--ORDER BY custid
GO
tapi terjadi error :
Column 'Production.Products.productid' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
adakah yang tahu letak kesalahannya?
0
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban