MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old June 14th, 2004, 11:41 AM
access_user access_user is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 13 access_user User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Help: sum values from column in counted rows

Hi- I could use some help with returning the SUM of the values from COUNT rows from a table. See query code below for what I am gathering now -


Code:
SELECT Count(LCCLASS_VW.MFHD_ID) AS CountOfMFHD_ID, LCCLASS_VW.LONGCLASS
FROM LCCLASS_VW
GROUP BY LCCLASS_VW.LONGCLASS
HAVING (((LCCLASS_VW.LONGCLASS) Between 'QD    1' And 'QD  999'));


A sample of what is returned:

Count LongClass
1000 QA 1
567 QA 10

What I want to return is the sum of these two rows' Count column (or 1567).
Thanks for any help!

Mike

Reply With Quote
  #2  
Old June 14th, 2004, 12:00 PM
swampBoogie swampBoogie is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jan 2003
Location: Paris Uppland
Posts: 1,762 swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 4 h 29 m 45 sec
Reputation Power: 37
Code:
SELECT count(*) AS CountOfMFHD_ID
FROM LCCLASS_VW
where LONGCLASS Between 'QD    1' And 'QD  999'

Reply With Quote
  #3  
Old June 14th, 2004, 01:05 PM
access_user access_user is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 13 access_user User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up Thnx!!!!!!!!!!!

Hey, Thanks for the quick resopnse. It did the trick, much appreciated there swampboogie .


mike

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Help: sum values from column in counted rows


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway