My database has the following 2 tables:
RqProjectDocuments RqDocuments
Id DocumentId ID
12 10 10
12 11 11
12 12 12
12 13 13
13 20 20
13 21 21
13 22 22
13 23 23
This select statement works as expected and displays 4 rows.
select Name, ProjectId, DocumentId RqDocID, id
from RqProjectDocuments A, RqDocuments B where A.DocumentId = B.Id and projectId = 12
I then wanted to update Rqdocuments with the following SQL statements. But this statement updates all the records in Rqdocuments. It should only update 4? Any Ideas?
update RqDocuments
set RqDocuments.FileDirectory = 'c:\Projects',VersionNumber = VersionNumber + .0001,VersionUserId = 99,
VersionDateTime = Sysdate, VersionReason = 'RequistePro Document Update'
where exists
(select A.ProjectId, A.DocumentId, B.id
from RqProjectDocuments A, RqDocuments B where A.DocumentId = B.Id and A.ProjectId = 12)
RqProjectDocuments RqDocuments
Id DocumentId ID
12 10 10
12 11 11
12 12 12
12 13 13
13 20 20
13 21 21
13 22 22
13 23 23
This select statement works as expected and displays 4 rows.
select Name, ProjectId, DocumentId RqDocID, id
from RqProjectDocuments A, RqDocuments B where A.DocumentId = B.Id and projectId = 12
I then wanted to update Rqdocuments with the following SQL statements. But this statement updates all the records in Rqdocuments. It should only update 4? Any Ideas?
update RqDocuments
set RqDocuments.FileDirectory = 'c:\Projects',VersionNumber = VersionNumber + .0001,VersionUserId = 99,
VersionDateTime = Sysdate, VersionReason = 'RequistePro Document Update'
where exists
(select A.ProjectId, A.DocumentId, B.id
from RqProjectDocuments A, RqDocuments B where A.DocumentId = B.Id and A.ProjectId = 12)