Postgresql – If I have a priority list, how do I select the middle value in SQL?
I have a couple of organizations in my company that has associated "group categories" assigned to them with individual priority_level's. I have a query with WHERE gc.priority_level = (SELECT MIN(gc_inner.priority_level) ...), as first_category and WHERE gc.priority_level = (SELECT MAX(gc_inner.priority_level) ...),…