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 |
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2012-02-21 : 13:15:11
|
| So i was originally going to look for matches between two tables by using:SELECT * FROM GCSOCONV.dbo.MNICOMPARE t1INNER JOIN MNI.dbo.MNI t2ON FNAME = FNAMEAND MNAME = MNAMEAND LNAME = LNAMEAND t1.DOB = t2.DOBAND t1.RACE = t2.RACEAND t1.HAIR = t2.HAIRORDER BY t1.LNAMEThen delete those entries by changing the select statement to a delete statement. I've decided against deleting those entries and instead have added a bit column with a default value of "true" to the MNICOMPARE table. Now i would like this query to change the value of that column ('INCLUDE') to '0' where there is a match. I know this is an update/set statement, but how do i work it syntactically into the select? Would it be?:Update MNICOMPARE set INCLUDE='0' where SELECT(SELECT * FROM GCSOCONV.dbo.MNICOMPARE t1INNER JOIN MNI.dbo.MNI t2ON FNAME = FNAMEAND MNAME = MNAMEAND LNAME = LNAMEAND t1.DOB = t2.DOBAND t1.RACE = t2.RACEAND t1.HAIR = t2.HAIR)ORDER BY t1.LNAMEOr am i wrong?thanks |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2012-02-21 : 13:22:42
|
| Thanks! |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|