在额外的列中对检索到的数据进行连续编号
我想在使用 SELECT DISTINCT 查询时获得编号游标。
表:
| _id | Name |
| 1 | Jones |
| 2 | Smith |
| 3 | Jones |
| 4 | Taylor|
| 5 | Brown |
| 6 | Brown |
| 7 | Brown |
我想要得到这样的光标:
| _id | Name |
| 1 | Jones |
| 2 | Smith |
| 3 | Taylor|
| 4 | Brown |
我尝试了很多,但没有成功。 有时没有唯一值,有时在选择项目时会出现以下错误:
08-22 22:18:15.413: ERROR/AndroidRuntime(1053): java.lang.IllegalStateException: this should only be called when the cursor is valid
感谢您的帮助!
I want to get a numbered cursor when I use a SELECT DISTINCT query.
Table:
| _id | Name |
| 1 | Jones |
| 2 | Smith |
| 3 | Jones |
| 4 | Taylor|
| 5 | Brown |
| 6 | Brown |
| 7 | Brown |
What I want to get a cursor like this:
| _id | Name |
| 1 | Jones |
| 2 | Smith |
| 3 | Taylor|
| 4 | Brown |
I tried a lot but it wasn't working.
Sometimes there were no unique values and sometimes I get the following error when I selected an Item:
08-22 22:18:15.413: ERROR/AndroidRuntime(1053): java.lang.IllegalStateException: this should only be called when the cursor is valid
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为最简单的方法是使用临时表:
I think the easiest method is to use a temporary table: