The below query returns me two rows:
SELECT
DocList.DocListId, RegistrationDocList.RegistrationDocListId, Registration.RegistrationId
FROM
DocList INNER JOIN
RegistrationDocList ON DocList.DocListId = RegistrationDocList.DocListId INNER JOIN
Registration ON RegistrationDocList.RegistrationId = Registration.RegistrationId
WHERE (DocList.DocListId = 547)
Results:
-------------------------------------------------------- DocListId RegistrationDocListId RegistrationId ------------------------------------------------------- 547 097 115 547 098 116
UPDATE:
as you can see its using three tables, so i want to delete the rows from:
DocList where doclistid = 547
RegistrationDocList.RegistrationId where RegistrationId in (097,098)
Registration.RegistrationId where RegistrationId in (115,116)
You need to cache the values to delete on the far side of the link table, delete the link records, and then delete the linked records:
Maybe I missed your point. I hope this code will help you: