Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Please Help...SQL problem (total)
Old 12-19-2006, 03:17 AM Please Help...SQL problem (total)
Junior Talker

Posts: 2
Trades: 0
Hello, i need help on this, appreciate very much:

ID Price Amount
-- ---- -------
1 15 4
2 20 2

How to display out the total of it? Example above, the total should be 100, but how to apply it in programming environment.

Thanks very much for the contribute help.
mick3256 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-19-2006, 08:38 AM Re: Please Help...SQL problem (total)
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
in SQL

SELECT SUM(price * amount) as total_value
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-19-2006, 12:16 PM Re: Please Help...SQL problem (total)
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Make sure you add "from {table}". Just in case...Hirst didn't because you didn't supply the table name. But just because I see that question being asked, it's:

Select Sum (price * amount) from {table} <--- replace this part with the name of your table.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 12-19-2006, 07:32 PM Re: Please Help...SQL problem (total)
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Good catch
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-19-2006, 07:50 PM Re: Please Help...SQL problem (total)
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Someone's gotta make sure you're corrected on the 2 times a year you mess up. The 4998 times you're right have nothing to do with it.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 12-21-2006, 04:14 AM Re: Please Help...SQL problem (total)
Junior Talker

Posts: 2
Trades: 0
Thanks man
mick3256 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Please Help...SQL problem (total)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26689 seconds with 12 queries