Hey
below is a table i created

ProductId ----- Qty -------

1 ----- 2 -------
2 ----- 2 -------
1 ----- 2 -------
1 ----- 2 -------
2 ----- 2 -------
1 ----- 2 -------

Wat i am trying to do is get my sql statement select and display my result like

ProductId ----- Qty -------
1 ----- 8 -------
2 ----- 4 -------

Below is my code

Quoted Text Here
SELECT Detail.ProductID , Sum (Distinct Detail.Qty)as Qty , Head.SalesDate
FROM Detail INNER JOIN
Head ON Detail.HeadID = Head.HeadID
Where datepart(month,getdate()) = MONTH ( SalesDate )
Group By Detail.ProductID, Detail.Qty , Head.SalesDate

Quoted Text Here

The secon half works how do i get the first bit to work

Thanks

In the group by just list the Detail.ProductID. Or if you want it broken down by date then list date and Detail.ProductID. Don't list the quantity.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.