K Pathak

K Pathak

  • 2k
  • 131
  • 2.9k

SQL script to select/delete multiple rows from two tables

Aug 17 2018 9:58 AM
I need to write a sql script which loop through multiple records from two different tables joined with foreign key into cursor.
 
The data to be selected/deleted are known so that can be entered in a script.
 
 
For exaMPLE
 
Table A
 
 

Emp_Id

Name

1

abc

2

Xyz

3

pqr

 
Table B
 

Comp_id

Name

Emp_id

10

A

1

20

B

2

30

C

3

 
 
I want to select/delete Emp_Id 1 and 3 from both the tables using sql script 

Answers (2)