sql - How to update another table if they are related? -


i have 2 tables tblicence , tbcompanyagent shown in screenshot

enter image description here

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.

https://msdn.microsoft.com/en-us/library/ms189799.aspx

it should on update trigger. rows updated in pseudo-table inserted.

here can see example

sql triggers - how updated value?


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -