![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SQL
ccsbb
热爱生活,热爱编程
展开
-
sql表联合更新
两个表联合修改update b set b.need = (select [name] from a where a.id = b.id)原创 2009-09-24 09:22:00 · 569 阅读 · 0 评论 -
取表倒数第二条数据
例:要取得上次登录时间,本次登录已经记录,只能取倒数第二条方法:SELECT 时间 FROM(select 时间,row_number() OVER (ORDER BY 时间 DESC) as RowNumber from 日志 with (nolock) where user_id=1) AS A where RowNumber=2原创 2009-09-24 09:26:00 · 3168 阅读 · 0 评论