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 |
|
StarMan
Starting Member
2 Posts |
Posted - 2010-05-28 : 16:36:50
|
| Hi,not that I am lazy, but I can't find a proper solution for this specific problem.IN SQL SERVER 2005 I want to update FieldA in table AAA with the value of FIELB in table BBB ONLY when FIELDC in BBB = 'true' (boolean)Without the FIELDC = TRUE I used this code (and this works fine)Update AAA SET FieldA = (SELECT FieldB FROM BBB WHERE Field_ID = AAA.FIELD_ID)FROM TABLEA AAANow, with the restriction that the update can happen when FIELDC in BBB has the boolean value 'YES' I am stuck!!!!Example (from SQL SERVER 2005, giving an error):UPDATE AAASET FieldA = (SELECT FieldB FROM BBB WHERE (Field_ID = AAA.Field_ID) AND (FieldC = 'TRUE'))THIS does not work...........I've done the same in ACCESS 2007 and this works:Update AAAINNER JOIN BBBON AAA.Field_ID = BBB.Field_IDSet AAA.FieldA = BBB.FieldBWhere BBB.FieldC = TrueANYONE? ANYONE, please?Thanks in advance,Paul |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|