Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete From Table

Status
Not open for further replies.

serino

Programmer
Feb 13, 2003
107
US
Hi, I am receiving the error: "Specify the Table containing the records you want to delete." When i try to run the query below. Any suggestions on what I am missing here?


DELETE PT_102_Employee_Attendance_Table.[DateofOccurrence], *
FROM PT_102_Employee_Attendance_Table, AT_271_Isolate_Last_Years_Date_From_Today_Table
WHERE (((PT_102_Employee_Attendance_Table.[DateofOccurrence])<=(AT_271_Isolate_Last_Years_Date_From_Today_Table.[LastYRDTE])));
 
As the error says: which table do you want to Delete from?
[tt]PT_102_Employee_Attendance_Table[/tt] or
[tt]AT_271_Isolate_Last_Years_Date_From_Today_Table[/tt]

Assuming you want to delete records from [tt]PT_102_Employee_Attendance_Table[/tt]...
In my opinion, the safest way to do it is first to create Select statement and see the records you want to delete:

[tt][red]SELECT[/red] *
FROM PT_102_Employee_Attendance_Table
WHERE DateofOccurrence <=
(SELECT LastYRDTE
FROM AT_271_Isolate_Last_Years_Date_From_Today_Table)[/tt]

(assuming, again, the 'inner' Select returns one value (date) only)

and if that looks right, replace [red]SELECT[/red] with [red]DELETE[/red]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top