-2

I have 2 tables Patient, Individual Both has some common data, I want to delete record from both tables. What I have tried so far is:

delete p,i from #patient p
inner join #individual i on i.patientUid=p.patientUid
where p.patientuid='test id'

Error:Incorrect syntax near ','.

:(

nishant
  • 61
  • 1
  • 10

1 Answers1

1

You need two statements, one for each table.

For example:

delete p from #patient p
inner join #individual i on i.patientUid=p.patientUid
where p.patientuid='test id'

delete i from #individual i
inner join #patient p on i.patientUid=p.patientUid
where p.patientuid='test id'
thepirat000
  • 12,362
  • 4
  • 46
  • 72