0
我希望我能很好地解释我的问题。
我有一个没有主键的表。为了得到唯一的行,我必须select distinct (make, model, category,onhand)
在一起,结果是2行的每一个与现有量is null
和其他现有量is not null
。
sql server更新同一表中的重复行
现在我要做的就是更新我的表set null onhand = onhand with value
每个重复行
我有这个查询找到重复-2为每个
select distinct MAKE, MODEL, category, PRGR,
CountDuplicateRows= COUNT(1) --column to count the number of duplicates
from [OITM2]
WHERE PRGR !='p'
GROUP BY MAKE, MODEL, category, PRGR
HAVING COUNT(1)>1 --more than one record
ORDER BY COUNT(1) DESC --sort by most duplicates
但我无法弄清楚如何更新手动null
。我正在使用SQL Server 2008 R2。
谢谢
日Thnx很多,第二个就是我到底需要! – Sam