Hey guys, how the heck do I go about doing this.
I have an address book I’m making and I’m trying to figure out how to tackle my groups. I let the users rename their groups at will. But then this complicates my life ;0
I have 2 tables. groups and contacts the groups has the group names per user. the contacts has a group column that says what group that contact entry belongs to.
How can I rename a group from the groups table and have the new name reflect in the contacts table so everything matches up?
I would suggest changing your model.
Use
IDs as primary keys and an intersection-table to assign your contacts to groups:Now you can change the group-name whenever you want, without updating the contacts.
EDIT: If you only want to get the contacts of a certain group, use a SELECT like this one: