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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.