sql - How to update another table if they are related? -
i have 2 tables tblicence , tbcompanyagent shown in screenshot
there common columns values present in tbcompanyagent of in tblicence licensenumber, licenseissuedate , licenseexpirationdate. after complex sql querires , business requirement, columns stateissuedlicensenumber, stateissuedlicenseissuedate , statedissuedlicenseexpirationdate , columns licencenumber, dateissued , expirationdate in tblicence merged single column licensenumber, licenseissuedate , licenseexpirationdate in tbcompanyagent.
also values in stateissuedlicensenumber, stateissuedlicenseissuedate , statedissuedlicenseexpirationdate same same group of records identified group id column licencetype.
actually there 1 resident entry licences stored in stateissuedlicensenumber, stateissuedlicenseissuedate , statedissuedlicenseexpirationdate columns , identified resident column 1 value.
non resident licences stored in licencenumber, dateissued , expirationdate 0 value.
my question if user try make updation in tblicence should reflected on tbcompanyagent. how write query. please help!!!
you can use trigger that.
it should on update trigger. rows updated in pseudo-table inserted.
here can see example
Comments
Post a Comment