SQL语句总结

工作中用到的sql语句列出来,便于以后查看。
1.查询每人的最新的一条记录
select * from 
(select id,userid,Name,uploadtime,ROW_NUMBER() 
over(partition by userid order by uploadtime desc) as new_index  
from table) a where a.new_index=1

2.

你可能感兴趣的:(sql)