I have a peculiar dupes problem. I can identify the records easily enough, but I need to do what's essentially a merge on some accompanying data.
Here's the problem. My table is a bit like this:
CREATE TABLE `People` (
  `PersonId` int(11) NOT NULL AUTO_INCREMENT,
  `Address` varchar(255) DEFAULT NULL,
  `Title` varchar(50) DEFAULT NULL,
  `Forename` varchar(150) DEFAULT NULL,
  `Surname` varchar(150) DEFAULT NULL,
  `FlagOne` bit(1) NOT NULL DEFAULT b'0',
  `FlagTwo` bit(1) NOT NULL DEFAULT b'0',
  `FlagThree` bit(1) NOT NULL DEFAULT b'0',
  PRIMARY KEY (`PersonId`)
)
The duplicate records differ only in title and flag values - they are identified as duplicates by having identical address, forename and surname fields:
PersonId    Address         Title   Forename    Surname FlagOne FlagTwo FlagThree
1           6 Smith Street  Mrs     Jane        Doe     1       0       0
2           6 Smith Street  Ms      Jane        Doe     0       1       0
What I can't figure out how to do is amalgamate these two into a single record which retains all the positive flags. It doesn't matter which of the two original records is retained - using PersonId to differentiate them is fine. So, something like this is the desired result:
PersonId    Address         Title   Forename    Surname FlagOne FlagTwo FlagThree
2           6 Smith Street  Ms      Jane        Doe     1       1       0
I know how to do an update based on a join, but I'm not sure how to implement the condiationals needed to get this particular result?
 
     
     
    