Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 26th, 2004, 02:29 AM
szy szy is offline
Registered User
Join Date: Apr 2004
Location: ÖØÇì, , China.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to sum ??

I have a Table like this?
name producttype price time
Jack chair $3 4-26
Jack desk $8 4-26
jack bed $11 4-26
Tom chair $4 4-26
Tom desk $7 4-26
Tom bed $16 4-26
Jack chair $3 4-27
Jack desk $8 4-27
jack bed $11 4-27
Tom chair $4 4-27
Tom desk $7 4-27
Tom bed $16 4-27
I want to perform a sql query to return results like this:
name pay time
Jack ? 4
Tome ? 4
 how to gain the pay ?
Any hint will be greatly appreciated.

Reply With Quote
  #2 (permalink)  
Old April 26th, 2004, 04:02 AM
Friend of Wrox
Join Date: Jun 2003
Location: Cardiff, , United Kingdom.
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts

Try this:
  SELECT name, Sum(price)
    FROM YourTable
That will group each of the names together and calculate the sum of the price's for each person.

Owain Williams
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to sum in for-each Gjella XSLT 1 October 2nd, 2006 08:48 AM
Help: Running Sum (or Cumulative Sum) timdasa VB Databases Basics 1 August 22nd, 2006 03:12 PM
sum utarian Access 2 March 28th, 2005 09:42 PM
need sum help! jbik BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 December 20th, 2004 05:27 PM
SUM or What bertlf Pro VB Databases 2 November 29th, 2003 02:44 PM

All times are GMT -4. The time now is 05:03 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.