问一个基础的问题,
简要描述表X的情况: xm,nd,dm同一个xm在不同的nd里可能有不同的dm现要修改表X里同一个xm里nd最小的dm值为1update X
set dm=1
where ???
简要描述表X的情况: xm,nd,dm同一个xm在不同的nd里可能有不同的dm现要修改表X里同一个xm里nd最小的dm值为1update X
set dm=1
where ???
解决方案 »
- 如何将*.sql数据库脚本导入到sqlserver2005中,急!!!
- 关于SQL server的登录用户和数据库用户问题!!!
- 求SQL语句按时间段分组
- 寻解决办法,求sql语句
- 求救一个FORMAT 格式问题
- 查看表结构的sql语句是什么?
- ## ~~~~~~~~~~各路搞手,SortID问题~~~~~~~~~~~ ##
- 一个ACCESS超难题。在ASP for CSDN版找不到答案,来这里求救了。
- 遇到除零错误怎么解决
- 关于日期时间型的问题
- 把已存在的数据表,用UPDATE把某一列数据计数下来
- TADOStoredProc.ProcedureName="sp_AutoMoney;1" 其中 ";1" 是什么意思?
dm=1
from 表X t
where not exists(select 1
from 表X
where xm=t.xm and nd<t.xm)
update x1 set dm=1 from X x1 where nd=(select min(nd) from X x2 where x2.xm=x1.xm)
set dm=1
from x a,(select xm,min(nd) as nd from x group by xm) b
where a.xm=b.xm and a.nd=b.nd
set dm = 1
from x t where not exists(select 1 from x where xm = t.xm and nd < t.nd)update x
set dm = 1
from x t where nd = (select min(nd) from x where xm = t.xm)