[mr2984] Use Sql Statements in groups code and small code style