Hello and welcome to our community! Is this your first visit?
Register
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
    Posts
    1
    Thanks
    0
    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

    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)

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,210
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    You have to tell us WHAT database you are using. The syntax for UPDATE using multiple tables is very different with different databases.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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