关于SQL查询语句加个序号列的问题
表结构如下
uid EpName isPass
1 aaaaa 0
2 bbbbb 0
3 ccccc 1
4 ddddd 0
5 eeeee 0
6 fffff 1
7 ggggg 0
我写的查询语句 select EpName,isPass from EpUser where isPass=0
我要的结果
序号 EpUser isPass
1 aaaaa 0
2 bbbbb 0
3 ddddd 0
4 eeeee 0
5 ggggg 0
------解决方案-------------------- 如果EpName是有序的
select ID = (Select Count(ID) from EpUser Where EpUser <= A.EpUser And isPass=0), EpName,isPass from EpUser A where isPass=0