How do I delete files from a table in MSDE 2000 that is selected by 3 joins?

StackOverflow https://stackoverflow.com/questions/8511471

  •  16-03-2021
  •  | 
  •  

I have a VB6 program that uses a n Access backend. The query that I am currently using is

sQuery = "DELETE tblResultNotes.* " & _
             "FROM (tblJobs INNER JOIN tblResults ON tblJobs.JobID=tblResults.JobID) INNER JOIN tblResultNotes ON tblResults.ResultID=tblResultNotes.ResultID " & _
             "WHERE (tblJobs.CreateDate)< #" & strDate & "# " & _
             "AND tblResults.StartTime < #" & strDate & "#;"

I have changed my backend to MSDE 2000 and now this query is giving me a syntax error near '*'. Could someone help me out?

Thanks, Tom

有帮助吗?

解决方案

Try changing your SQL to this:

sQuery = "DELETE FROM tblREsultNotes " & _
"FROM " & _
"    tblJobs" & _
"    INNER JOIN tblResults ON tblJobs.JobID=tblResults.JobID" & _
"    INNER JOIN tblResultNotes ON tblResults.ResultID=tblResultNotes.ResultID" & _
"WHERE tblJobs.CreateDate < '" & strDate & "'" & _
"AND tblResults.StartTime < '" & strDate & "'"

Note the date delimiter change to ' instead of #.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top