PDA

View Full Version : Update Query


AMellon
06-30-2010, 04:26 PM
Hi there

I am trying to match to 2 fields on the same table, but the selection criteria is located on another table.

You will see that I am trying to match what the customer has paid (cenPaid) against what the cost is (cenCost) to remove the person from default.

The criteria for this matching up is the course start date Courses.crsFirstSession). I am sure it is very simple, But I just dont know how else to write this.

Any help will be appreciated

Thanks in advance

Ana
UPDATE Enrolments
SET cenCost = cenPaid
WHERE (Courses.crsFirstSession < CONVERT(DATETIME, '2008-04-01 00:00:00', 102))
(SELECT Courses.crsFirstSession
FROM Enrolments INNER JOIN Courses ON Enrolments.cenVenue = Courses.crsVenue AND Enrolments.cenGroupCode = Courses.crsGroupCode AND
Enrolments.cenCode = Courses.crsCode AND Enrolments.cenCourseOrSes = Courses.crsCourseOrSes)

Old Pedant
07-03-2010, 08:03 PM
You have to tell us WHAT database you are using. The syntax for UPDATE using multiple tables is very different with different databases.