Senovia/Musa: Reduce duplication in SQL