I have a DB View that contains
- a column from table A that is a number called
maximum slots
- another column that is a count of a related table’s rows
sessionCount
.
Maximum slots is the maximum amount of students a tutor is allows.
The count of session rows is a tutor’s actual active students at this given point in time.
Is there a way to add a column that provides a calculation between the two ie. sessionCount - maximum slots
?
I know that if both maxslots and sessionCount were simple properties, I can create an addition column with a number operation. But is there any way to have this subtraction as an automatic column when sessionCount is actually a count of rows in a related table?
The objective is to calculate “remaining capacity” of a tutor. It happens today that sessionCount is higher than maxslots as in the screenshot, and I want to see when this happens so I can prevent it in the future.