From: Gremlin on
Hi Guys,

Ok I have a data table containing duplicate Reciept numbers and a
transaction value for each record, I need to simply list the total for
each unique Reciept number, this is obviously a simple problem but I
am missing something.

Any help is much appriciated


" SELECT Gf_Receipt_number AS Reciept, SUM (Gf_Amount) AS Total
FROM [TestP].[dbo].[Gf]
WHERE Gf_Receipt_number IS NOT NULL
GROUP BY Gf_Amount "
From: Gremlin on
Would probably help to mention the the error I am recieving is:

Column 'TestP.dbo.Gf.Gf_Receipt_number' is invalid in the select list
because it is not contained in either an aggregate function or the
GROUP BY clause.

I have done some reading on this problem but have not reached a
solution, a small explination would be great too, and would save me a
return trip hopefully!
From: Gremlin on
Issue was resolved. For future reference to anyone else who stumbles
across this, I was attempting to group by Gf_Amount, I infact needed
to be grouping by Gf_Receipt.

Noob!
 | 
Pages: 1
Prev: Trigger
Next: Limiting a column to certain values