Delete Query Question

  • Thread starter Thread starter Keith Johnson
  • Start date Start date
K

Keith Johnson

I have 2 tables, PatSat and Temp. I need to delete all
records from PatSat that occur in Temp and I can't get it
to work. The SQL I'm using is:

DELETE [patSat].*, [Temp].[FirstOfHospital Acct#]
FROM [patSat] INNER JOIN [Temp] ON [patSat].[Hospital
Acct Number] = [Temp].[FirstOfHospital Acct#]
WHERE ((([Temp].[FirstOfHospital Acct#]) Is Not Null));

HELP!!!
 
DELETE [patSat].*, [Temp].[FirstOfHospital Acct#]
FROM [patSat] INNER JOIN [Temp] ON [patSat].[Hospital
Acct Number] = [Temp].[FirstOfHospital Acct#]
WHERE ((([Temp].[FirstOfHospital Acct#]) Is Not Null));

Just remove the [Temp] reference from the DELETE clause, since you
don't want to delete from Temp:

DELETE [patSat].*
FROM [patSat] INNER JOIN [Temp] ON [patSat].[Hospital
Acct Number] = [Temp].[FirstOfHospital Acct#]
WHERE ((([Temp].[FirstOfHospital Acct#]) Is Not Null));
 
Back
Top