|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL Query With SUM()
Hi,
I have one single table with the follwing fields: ID, Status,Group, Owner,Code The code field contains (high,Low,Medium) Data I would like to retrieve the sum of the code field for a specific owner and group. Owner Code(total of highs, lows and Mediums) ------- ---------------- name 7 Here is my sql SELECT ID, OWNER,GROUP,CODE, STATUS FROM tablename GROUP BY OWNER, CODE HAVING sum( Status) <> 'Closed' AND OWNER='name' AND Group='grpname' I'm new to ORacle and I hope this make sens. Thanks in advance. |
|
#2
|
||||
|
||||
|
Does the Code field actually contain the text "High", "Medium" and "Low"???
Post some sample data. |
|
#3
|
|||
|
|||
|
Quote:
Yes it does |
|
#4
|
||||
|
||||
|
okay, dumb question then...how do you plan on summing the values of text? answer: You can't.
Where's your sample data. |
|
#5
|
|||
|
|||
|
Quote:
I think I got it. I just needed to use Count(*) instead of Sum() here is the query Select COUNT(*) From Tablename WHERE STATUS <> 'Closed' AND OWNER='name'. Thank you anyway |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > SQL Query With SUM() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|