I have a classifieds system I'm working on.
People are able to add photos to a classified, but I only display one when displaying the list of classifieds.
To do that, I have a linking table between classifieds and photos that has a "is_main" boolean field.
When someone deletes one of their classified photos, I want to:
1) See if there is more than that photo tied to the classified.
2) If there is, update the next photo and set that "is_main" field to TRUE.
Just trying to find out the most efficient way to do this.