Print Page | Close Window

Adding Values Within Records

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=2008
Printed Date: 29 March 2026 at 8:08pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Adding Values Within Records
Posted By: jdumayas
Subject: Adding Values Within Records
Date Posted: 23 April 2003 at 7:08am
I'm looking for suggestion on how to approach generating reports from a DB.

Here is a high view of the tables that the report is generated from.

tblCourse
courseID, coursetitle, blah

tblOffering
offeringID, offeringDate, courseID, offeringsize, blah

tblOfferingStudentLookup
offeringID, studentID, blah

tblstudent
studentID, studentName, blah


Users would enter a date range in a form to generate the report.

My issue is if courseA is delivered multiple times during within the date range, I still only want the report to list course A with the totals of the offeringsize, and total of the number of students attended. As opposed to having every offering listed.

What I can get is:

Course A, 16, 15
Course A, 20, 18
Course A, 8, 10
Course A, 14, 14
Course B, 10, 10
Course B, 12, 11

What I want to get is:

Course A, 58, 57
Course B, 12, 11

Any suggestions or sample code would be greatly appreciated. Thanks



Replies:
Posted By: Bunce
Date Posted: 27 April 2003 at 9:16pm

SELECT
    CourseName, Sum(OfferingSize), Sum(NoStudents)
FROM
    TheTable
GROUP BY
    CourseName

Check out http://www.w3schools.com/sql - http://www.w3schools.com/sql for more info.

Cheers,
Andrew



-------------
There have been many, many posts made throughout the world...
This was one of them.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net