Update the tmp group_id field now we have the groups table to use.
Change INSERT new predb entries to use the group_id instead of the JOIN and groupname.