System.Data.SqlClient.SqlConnection x = new System.Data.SqlClient.SqlConnection("...");
System.Data.SqlClient.SqlCommand y =new System.Data.SqlClient.SqlCommand("update RevcordBiao set Time = getdate() from RevcordBiao a where time = (select max(time) from RevcordBiao where id = a.id) and id = 5",x);
y.ExecuteNonQuery();
System.Data.SqlClient.SqlCommand y =new System.Data.SqlClient.SqlCommand("update RevcordBiao set Time = getdate() from RevcordBiao a where time = (select max(time) from RevcordBiao where id = a.id) and id = 5",x);
y.ExecuteNonQuery();
update RevcordBiao set [time]=getdate() where [time]=(select top 1 [time] from RevcordBiao where id=5 order by datediff(day,[time],getdate()))
update RevcordBiao set [time]=getdate() where [time]=(select top 1 [time] from RevcordBiao where id=5 order by abs(datediff(day,[time],getdate())))
你的SQL语句我调试怎么老是有问题啊,你试没试啊
??????????
???????
??????哪就把day 该成second,参见datediff()联机帮助
set Time = getdate()
from RevcordBiao a
where time = (select max(time)
from RevcordBiao
where id = a.id)
and id = 5