Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

FN-FORUM: SQL help

date posted 9th July 2007 18:51

Hi

I have a database containing tables structured like so:

tblVendors
ID
VendorTitle


tblCertifications
ID
VendorID


tblCertificationListings
ID
CertificationID

So I have Vendors that have Certifications. And those Certifications
are listed in a Certification Listings table (so they can be linked to
Courses =96 I haven't shown that above as it's not relevant to what I'm
stuck on). I need to write a script that deletes Vendors, and also
deletes everything associated with them. So I need to delete any
entries in tblCertificationListings that are linked to the Vendors
(through tblCertifications).

If I run this SQL statement:

sql1 =3D "SELECT tblVendors.ID, tblCertifications.VendorID,
tblCertifications.ID, tblCertificationListings.CertificationID FROM
(tblVendors INNER JOIN tblCertifications ON tblVendors.ID =3D
tblCertifications.VendorID) INNER JOIN tblCertificationListings ON
tblCertifications.ID =3D tblCertificationListings.CertificationID WHERE
tblVendors.ID=3D" & strID & ";"

I can correctly loop through all the records. However when I loop
through them and try to delete them using =85

Do While Not rsDeleteCertificationListings.EOF
rsDeleteCertificationListings.Delete
rsDeleteCertificationListings.MoveNext
Loop

I get this error =85

Microsoft OLE DB Provider for ODBC Drivers (0x8000FFFF)
Query cannot be updated because the FROM clause is not a single simple
table name.

I know you can be 'delete' statements with SQL so tried changing the
'SELECT' part of my statement to 'DELETE' as in the below =85.

sql1 =3D "DELETE tblVendors.ID, tblCertifications.VendorID,
tblCertifications.ID, tblCertificationListings.CertificationID FROM
(tblVendors INNER JOIN tblCertifications ON tblVendors.ID =3D
tblCertifications.VendorID) INNER JOIN tblCertificationListings ON
tblCertifications.ID =3D tblCertificationListings.CertificationID WHERE
tblVendors.ID=3D" & strID & ";"

But I get this error message =85

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Specify the table containing
the records you want to delete.

Can anyone suggest what I need to change?
TIA
Paul



Messages by Day
July 31st 2007
July 30th 2007
July 29th 2007
July 28th 2007
July 27th 2007
July 26th 2007
July 25th 2007
July 24th 2007
July 23rd 2007
July 22nd 2007
July 21st 2007
July 20th 2007
July 19th 2007
July 18th 2007
July 17th 2007
July 16th 2007
July 15th 2007
July 14th 2007
July 13th 2007
July 12th 2007
July 11th 2007
July 10th 2007
July 9th 2007
July 8th 2007
July 7th 2007
July 6th 2007
July 5th 2007
July 4th 2007
July 3rd 2007
July 2nd 2007
July 1st 2007


Messages by Month
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000