If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Simple SUM Distinct Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-01-04, 03:28
Hatori Hatori is offline
Registered User
 
Join Date: Mar 2004
Posts: 2
Simple SUM Distinct Question

Hello ALL,

I am new to this forum and would like to ask of any person who can assist me in this problem.

I currently have a table with 3 rows like this:

Pid Counter P_cprice
19 3 49.5
16 5 143.5
16 2 143.5

I am trying to retrieve the following data:

19 3 49.5
16 7 143.5

I have tried many ways but am going nuts over this. It looks simple but I have no clue. Is there anyone who can help me?

Kevin.
Reply With Quote
  #2 (permalink)  
Old 03-01-04, 03:52
praveenpr praveenpr is offline
Registered User
 
Join Date: Jan 2004
Location: Singapore
Posts: 89
Re: Simple SUM Distinct Question

Quote:
Originally posted by Hatori


Hello ALL,


I am new to this forum and would like to ask of any person who can assist me in this problem.

I currently have a table with 3 rows like this:

Pid Counter P_cprice
19 3 49.5
16 5 143.5
16 2 143.5

I am trying to retrieve the following data:

19 3 49.5
16 7 143.5




I have tried many ways but am going nuts over this. It looks simple but I have no clue. Is there anyone who can help me?

Kevin.


select pid,sum(counter),p_cprice
from table_name
group by pid,p_cprice
__________________
Thanks and Regards,

Praveen Pulikunnu
Reply With Quote
  #3 (permalink)  
Old 03-01-04, 06:29
Hatori Hatori is offline
Registered User
 
Join Date: Mar 2004
Posts: 2
hmm...now why didn't i think of that? thanks a whole lot!
Reply With Quote
Reply

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 On
Pingbacks are On
Refbacks are On