求一SQL语句,急等!!!!!!!!!!
有一表如下:
c1 c2 cont
1 1
1 2
1 3
1 4
如何更新此表,在cont列中,统计同一c1时c2列中,比本身小的个数
例:第三行cont应为2
[解决办法]
update a set a.cont=(Select count(*) from tb
where c1=a.c1 and c2 <a.c2)
from tb as a