I found a problem with the following UPDATE in my SQL SERVER
UPDATE table_a SET table_a.More = -1 FROM table_a INNER JOIN ( SELECT column1, COUNT(*) AS More FROM table_a GROUP BY column1 ) AS table_b ON table_a.column1 = table_b.column1
Note that the INNER JOIN part uses this table. After this UPDATE I expect some lines to have More equal to -1 . But I only got 1 s. I am 100% sure that column1 has duplicates. What am I missing?
The problem I found out about is that some guy defined the More column as a bit type!
source share