Is there a function that I can use in MSSQL that will make one of my fields have a running total as it's value?
Posted on 2008-06-23
I have a database for a 'ClassSignUp'. One of the fields is the 'TotalSeats' in each class.
I have another table of 'Attendees' . This table contains a foreign key field of the 'ClassSignUp'.
I want each row in the 'ClassSignUp' to show the 'TotalSeats' as entered and I also want to calculate the 'RemainingSeats' to show in my grid or table.
For example, if the 'ClassSignUp' table has a 'class' that has been assigned 30 'TotalSeats', I want to also look into the 'Attendees' table and do a count('EventID') and subtract that number from the 'TotalSeats' column to show the 'RemainingSeats' for row table.
Thanks for any help!