https://techiworks.com/select-statement-inside-case-count-condition/