I have two sql tables called scan_sc and rescan_rsc. The scan table looks like this:
CREATE TABLE scan_sc
(
id_sc int(4),
Type_sc varchar(255),
ReScan_sc varchar(255),
PRIMARY KEY (id_sc)
)
When a scan a document I insert a row into the scan table. If the result of this scanning is poor I have to do a rescan, and therefore I have a rescan table.
CREATE TABLE rescan_rsc
(
id_rsc int(4),
Scan_rsc varchar(255),
PRIMARY KEY (id_rsc)
)
The problem is, I want to have a trigger that will fill in the column ReScannet_sc with an "x", in the scan_sc table, so I can see that there has been some problems here.
The trigger has to do it where the id from the rescan table is the same as in the scan table.
Hope you all understand my question.
Thanks in advance.
Do you really need the
ReScan_sccolumn and the trigger?With a simple
JOIN, you can find out the records in yourscan_sctable that have been re-scanned, without using theReScan_sccolumn at all.There are several possibilities:
Show all scans, with an additional column with the Rescan ID, if any:
Show only the scans which have been re-scanned:
(I assume that
id_scandid_rscare the primary keys and thatPRIMARY KEY (id_sd)is a typo, like marc_s pointed out in his comment)