Hello everyone,
Part of the functionality of my DB is to track my requests to different colleagues. I have a table of locations whose orders I need to verify. In some instances locations will be verified with a single file, and in other instances the locations will be verified with several files. I have a SQL Query that will set a flag on my table of locations to notify me that I am waiting on a colleague to respond.
For example:
Suppose I have two locations in tbl_STATUS( locID, RESP_REQD) and get the following result from my query:
In tbl_RESPONSE I have three entries (respID is my primary key, locID is the foreign key for tbl_STATUS) :
Even though only two rows are updated to a RESP_REQD flag in tbl_STATUS, the system warns me I am updating three rows. Will this cause problems down the road? Is there a way to force DISTINCT Values in my Update Statement?
Part of the functionality of my DB is to track my requests to different colleagues. I have a table of locations whose orders I need to verify. In some instances locations will be verified with a single file, and in other instances the locations will be verified with several files. I have a SQL Query that will set a flag on my table of locations to notify me that I am waiting on a colleague to respond.
For example:
Suppose I have two locations in tbl_STATUS( locID, RESP_REQD) and get the following result from my query:
locID | RESP_REQD |
123 | 1 |
456 | 1 |
In tbl_RESPONSE I have three entries (respID is my primary key, locID is the foreign key for tbl_STATUS) :
respID | locID | respFLG | fileName |
77 | 123 | 0 | fileA |
81 | 456 | 0 | fileB |
85 | 456 | 0 | fileC |
Even though only two rows are updated to a RESP_REQD flag in tbl_STATUS, the system warns me I am updating three rows. Will this cause problems down the road? Is there a way to force DISTINCT Values in my Update Statement?
SQL:
UPDATE tbl_STATUS a
INNER JOIN tbl_RESPONSE b
ON a.locID = b.locID
SET a.RESPONSE_REQD = 1
WHERE b.respFLG = 0
;