I’ve added a feature to a web site that shows what visitors have visited a user profile. The table representing this holds the id of the user profile and the id of user visiting the profile.
Obviously, it’s pointless showing that someone has visited their own profile so I modified the PHP code to detect this. In the meantime, a bit of data was written. This isn’t a problem because it represents only a handful of users and I can edit the information by hand.
My question is as follows. In the hypothetical case where I’d have to do the same thing for more data, what would be a good approach to finding rows where id1 = id2 and removing them?
1 Answer