/ Published in: SQL

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
TO just SET TO a predetermined VALUE (TRUE, FALSE, 1, 'foo', etc.) UPDATE tblDestination SET tblDestination.col=VALUE WHERE EXISTS ( SELECT col2.value FROM tblSource WHERE tblSource.join_col=tblDestination.join_col AND tblSource.constraint=VALUE ) More advanced (sets VALUE TO VALUE IN secondary SELECT statement): UPDATE tblDestination SET tblDestination.col=(SELECT col2.value FROM tblSource WHERE tblSource.join_col=tblDestination.join_col AND tblSource.constraint=VALUE) WHERE EXISTS ( SELECT col2.value FROM tblSource WHERE tblSource.join_col=tblDestination.join_col AND tblSource.constraint=VALUE )
Comments
