0
I need to delete a record from another table after the update of another table .
create table people ( id int identity (1,1) name varchar (50) Available char(3) primary key (id)) create table student ( id int, grade char(1), primary key(id), foreign key(id) references people (id)) people tablae student table id name Available id grade 1 john yes 2 B 2 sam yes if i update Available as 'NO' in sam all the records must delete in student table wich is grade.
3 Respostas
0
Look up 'Trigger in Sql' or 'Cascading SQL'
0
lowshuen, this is not an automatic executed statement as requested
- 1
UPDATE people SET Available='no' WHERE ....
DELETE FROM student WHERE id IN (SELECT id FROM people WHERE Available = 'no')