Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004
    Location
    NY
    Posts
    113

    Question Unanswered: Table Update Syntax Question

    I am trying to update a field(location) in tblPatient. Basicallly, I imported data from a flat file and during import, Location was not the same data type because it was joined to another table. I ran some queries and create a temp table called Z.

    UPDATE tblPatient
    SET z.locationID = tblPatient.Location
    WHERE z.PatientId=tblPatient.PatientID;

    I am trying to update the tblPatient.Location with the data in z.LocationID.

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    UPDATE tblPatient
    SET tblPatient.Location = z.locationID
    WHERE z.PatientId=tblPatient.PatientID;



  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    neither of those will work because they don't actually mention the z table
    Code:
    update tblPatient 
    inner 
      join z
        on tblPatient.PatientID = z.PatientId
       set tblPatient.Location = z.locationID
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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