Print Page | Close Window

Summing record from two tables

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=27363
Printed Date: 28 March 2026 at 5:31pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Summing record from two tables
Posted By: trafmore
Subject: Summing record from two tables
Date Posted: 13 May 2009 at 7:54pm
Hi everyone I am here to seek help. Here is my issue, I have two table that I creating a quarterly report from using ASP .net.  The table 1 holds records of every month and table 2 has a single quarterly record  of some other data. I have a Dropdown List from which the user selects the quarter from. I want when the user select second,third and fourth quarters that the report  get the sum of all the records up to that quarter in table 2 and the single record from table 1 for that selected quarter for each peson. Here is a look of what I have done but it does not give me what I want.

select FirstName + ' ' + LastName As EName,A.Vacation,A.Sick,A.AT, sum(Convert(decimal(10,2),Hours_Vac)) as VacUse,

sum(Convert(decimal(10,2),Hours_Sick)) as SickUse, SUM(CAST(SickOccur AS INT)) as SickOccur,

sum(Convert(decimal(10,2),HoursOT)) as HOT, sum(Convert(decimal(10,2),HoursAT)) as HAT From vwVacations AS V ,Quarterly_Balance AS A

Where V.IBMNum = A.IBMNum And V.Quater = A.Quarter And V.Yr = A.Yr and (Quater = 'First'




Replies:
Posted By: scottage
Date Posted: 15 June 2009 at 1:21pm
Hi trafmore, I think that we'll need some more information to go on here.

-------------
http://www.realwebdevelopers.com" rel="nofollow - Developing real world websites



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