[ATM][DB] Fix query for bank groups