Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPD STATEMENT - WHAT'S WRONG WITH IT - PLEASE! 1

Status
Not open for further replies.

RowenaB

Programmer
May 28, 2003
8
GB
Hi, I need to update a table based on another table in the same database. Simple one would think but I keep on getting a syntax error. I am pretty sure this would work in MicroSoft SQL but it does not seem to work here - what am a doing wrong?

I want to update the tkfirst column of the Timekeep with the value in the preferred column of the hrmstkupd table.
The link field in the tkinit column on each table.

UPDATE timekeep
SET tkfirst = hrmstkupd.preferred
FROM timekeep timekeep, hrmstkupd hrmstkupd
WHERE (((timekeep.tkinit)="AAB"))
AND timekeep.tkinit = hrmstkupd.tkinit


Thanks
Rowena
 
Hi,

Let the information that to be updated come from a subquery like:

UPDATE timekeep
SET tkfirst =
(select preferred
FROM hrmstkupd
WHERE timekeep.tkinit="AAB"
AND timekeep.tkinit = hrmstkupd.tkinit)

Regards,
Shriyan
"Information's pretty thin stuff unless mixed with experience."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top