Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with SUM([DISTINCT] query

Status
Not open for further replies.

admoore

IS-IT--Management
May 17, 2002
224
US
I have a table that is basically a ledger with id_numbers and corresponding "reward" transaction values... I want to sum the transaction values by id_number...

I tried:
SELECT DISTINCT `id_no` , SUM( `reward` ) AS BALANCE
FROM `test_ledger`
GROUP BY `id_no`

But it is not returning the expected result...

id_no is varchar and id_no is a decimal(8,2) type...

This should be such a simple query, I thought...

TIA,

-A
 
Upon further review, the problem is not my query. Looks like I have an issue with the integrity of the data in the table itself.

The anomaly lies elsewhere...

Thanks anyway...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top