Monday, May 24, 2010

SQL updatet with inner join

SQL update statement doesn't like to include an inner join clause -- although it is doable with a little modification. (Goo it with the keywords.) -- it definitely doesn't like to include an inner join and an aggregate clause at the same time. For example, the following does NOT work.
Update tableA
Set Flag = 1
From tableA
Inner Join tableB on tableA.ID = tableB.ID
Where ...
Group By tableB.ID

In this case, the option left is to use nested select statement.

No comments:

Post a Comment