Avoid Sql Conflicts When Inserting data At Same Time
There are many alternatives you could attempt, such as enforcing an exclusive table lock on the SELECT query (thus delaying one entry until after the other). 

My personal favorite would be to enforce staging - production tables just like many of the testing apps I manage. 

This way, it doesn’t matter the timing or order. Remember the group_ID column is a database column, so it’s best not to get lost in the details over a value whose only purpose is to enforce differentiating groups