Keeping DB Table sorted using multi-field formula (Microsoft SQL Server)
- by user298167
I have a JOB table, with two interesting columns:
Creation Date
Importance (high - 3, medium 2, low - 1).
A JOB record's priority calculated like this:
Priority = Importance * (time passed since creation)
The problem is, every time I would like to pick 200 jobs with highest priority, and I don't want to resort the table. Is there a way to keep rows sorted?
I was also thinking about having three tables one for High, Medium and Low and then sort those by Creation Date.