Multi-Table Delete?

J

JohnnyC

DELETE questions.question, answers.answer
FROM questions LEFT JOIN answers ON
questions.id=answers.questionId
WHERE questions.id=2;

I want to delete a question and answer pair even if a
question has not been answered yet. When I try to test
this in Access, it tells me that I need to select a
table. I thought I had. Any suggestions?
 
P

Paul Overway

The easiest way to do this would be to set referential integrity between the
tables with cascade delete. Then you would only need to delete from the
question table...answers would be deleted automatically.
 
J

JohnnyC

Thanks!
-----Original Message-----
The easiest way to do this would be to set referential integrity between the
tables with cascade delete. Then you would only need to delete from the
question table...answers would be deleted automatically.

--
Paul Overway
Logico Solutions, LLC
www.logico-solutions.com





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top