n8w Posted April 28, 2008 Share Posted April 28, 2008 I thought this would be easy but it doesn't work I want to delete all records that have the same ids in two colums for example I tried DELETE FROM mytable WHERE userid=judgeid So I would like to delete row 2 in the example below row #useridjudgeid 1 1231 2213 2 1122 1122 3 3234 123 4 543 443 Link to comment https://forums.phpfreaks.com/topic/103326-solved-how-do-i-delete-duplicates-in-two-colums/ Share on other sites More sharing options...
fenway Posted April 29, 2008 Share Posted April 29, 2008 You'd need to delete using a self join. Link to comment https://forums.phpfreaks.com/topic/103326-solved-how-do-i-delete-duplicates-in-two-colums/#findComment-529486 Share on other sites More sharing options...
n8w Posted April 29, 2008 Author Share Posted April 29, 2008 thanks! I looked up self joins and it still isn't clear how to do it .. as far as syntax .. can you show me an example? Thanks Link to comment https://forums.phpfreaks.com/topic/103326-solved-how-do-i-delete-duplicates-in-two-colums/#findComment-529494 Share on other sites More sharing options...
fenway Posted April 29, 2008 Share Posted April 29, 2008 DELETE t1 FROM mytable AS t1 INNER JOIN mytable AS t2 ON t1.userid=t2.judgeid Link to comment https://forums.phpfreaks.com/topic/103326-solved-how-do-i-delete-duplicates-in-two-colums/#findComment-529504 Share on other sites More sharing options...
n8w Posted April 29, 2008 Author Share Posted April 29, 2008 very interesting .. thanks so much for your help! Link to comment https://forums.phpfreaks.com/topic/103326-solved-how-do-i-delete-duplicates-in-two-colums/#findComment-529539 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.