怎么写这个表的查询 [英] how wrote query for this table

查看:98
本文介绍了怎么写这个表的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要查询此表



----------------------- ------------

HI i need a query for this table

-----------------------------------

id        name       datestart            endStart         coursid
1         ali        2012/02/02            2012/06/02         1010
02        amir       2012/02/03            2012/03/03         2020
3         saeed      2012/02/05            2012/03/20         8020
4         amir       2012/05/06            2012/06/20         2020
5         reza       2012/01/05            2012/01/09         9090
6         amir       2013/02/03            2013/03/03         2020
7         amir       2014/02/03            2014/03/03         2020
.
.



我需要这个结果


iam need this result

name       datestart            endStart         coursid      stage
amir       2012/02/03            2012/03/03         2020        1
amir       2012/05/06            2012/06/20         2020        2
amir       2013/02/03            2013/03/03         2020        3
amir       2014/02/03            2014/03/03         2020        4



如何提交阶段


how need filed stage

推荐答案

SELECT  
    name,
    datestart,
    endStart,
    coursid,
    ROW_NUMBER() OVER (ORDER BY name) stage
FROM    
    tableName


 SELECT  name, datestart, endStart, coursid, ROW_NUMBER() OVER (ORDER BY name) stage
 FROM table_Name
where name='amir'


这篇关于怎么写这个表的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆