jpkelly Posted October 19, 2012 Share Posted October 19, 2012 Hello, New at this DELETE thing. I wish to write a DELETE query that will remove records from the 'REPAIRS" table. The conditions that must be met is that the "active" field = false in the "REPAIRS" table and that the "tradeID" field in the "REPAIRTRADE" table = cet. I'm confused about the statement needed and the syntax. Any help is truly appreciated. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 19, 2012 Share Posted October 19, 2012 How are the repairs and repairtrade tables related? Link to comment Share on other sites More sharing options...
jpkelly Posted October 19, 2012 Author Share Posted October 19, 2012 JPEG attached, hope this helps! JK Link to comment Share on other sites More sharing options...
justsomeguy Posted October 19, 2012 Share Posted October 19, 2012 I don't see an active field in the repairs table, but from your description this should work: DELETE FROM repairs WHERE active=false AND repair_ID IN (SELECT repairID FROM repairtrade WHERE fieldID = 'cet') Link to comment Share on other sites More sharing options...
jpkelly Posted October 19, 2012 Author Share Posted October 19, 2012 Worked perfectly, thanks so much. Another little thing that I've learned. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now