Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2007-12-28 : 16:21:20
|
| I have the following two tables:Table Name: Table_DMDMID int UncheckedProgID int CheckedProjID int CheckedContractID int Checked****************************************Table Name: Table_RevisionsRevID int UncheckedDMID int CheckedRevNo real CheckedDeleted bit Checked*****************************************Update Table_Revisions set deleted='true' where Table_DM.DMID=Table_revisions.DMID and table_DM.progid=20 and Table_DM.Projid=20 and Table_DM.ContractID=67i am confused how to make a join condition between two table, the common field field between both the tables are DMID.Thank you very much for the help. |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2007-12-28 : 16:35:31
|
[code]--first look at the rows that the update statement will affectselect tr.*from Table_Revisions trinner join Table_DM tdm on tdm.DMID = tr.DMID --and tdm.projid = tr.projidwhere tdm.Projid=20 and tdm.ContractID=67--if the select looks good then go for the updateupdate tr set tr.deleted = 'true' from Table_Revisions trinner join Table_DM tdm on tdm.DMID = tr.DMID --and tdm.projid = tr.projidwhere tdm.Projid=20 and tdm.ContractID=67[/code]EDIT:your double mention of projid=20 confused me Be One with the OptimizerTG |
 |
|
|
|
|
|