Postgresql – Substracting two CASE Statements with 'AND' operator condition returns NULL when it should return a specific integer
I'm doing this StrataScratch SQL question. The suggested solution uses two subqueries for each max value of each department, and then it substracts them to get the absolute value. I wanted to solve this question using dense_rank/rank window function by…