Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Update Query

  1. #1
    New to the CF scene
    Join Date
    Jun 2010
    Thanked 0 Times in 0 Posts

    Update Query

    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

    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)

  2. #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Thanked 4,947 Times in 4,908 Posts
    You have to tell us WHAT database you are using. The syntax for UPDATE using multiple tables is very different with different databases.
    Be yourself. No one else is as qualified.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts