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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple - I want to add all integers in a column.

Status
Not open for further replies.

andrewEmbassy

Programmer
Aug 2, 2005
15
US
first post!

I'm a new MySQL user (currently working with ASP), and I'm really loving the flexibility it gives me, but I can't figure out how to do something that seems really simple to me-

I've got a column called itemShipping and a list of items that I want to sum- so I was thinking:
Code:
SELECT SUM('itemShipping') totalShipping FROM itemTable WHERE itemId IN ('SP6','SM100','SM346')

but this gives me itemShipping as equaling 0 (it should be like 150 or something).

A friend of mine is wondering if I need a GROUP BY clause in there- do I? Also, shouldn't I be able to find this info in the MySQL documentation? I found SUM() but I didn't find anything else about needing more than I've got...

Thanks!
 
Does that mean you're after realising the quotes should be left out?!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top