I have a question.

For example, if sqlite supports sequence() function that returns current
sequence number of result set then it can be used for this case, doesn't it?

ex)
select sequence(), * from mytable order by score desc;
1, 10,rosa,95,0
2, 6,kero,90,0
3, 1,anna,80,0
4, 2,qera,65,0

This runtime values on result set may help to solve some query scenarios.


2013/2/5 Igor Tandetnik <i...@tandetnik.org>

> On 2/4/2013 8:34 PM, Igor Tandetnik wrote:
>
>> On 2/4/2013 8:22 PM, YAN HONG YE wrote:
>>
>>> I hava a table like this:
>>> id,name,score,rank
>>> 1,anna,80,0
>>> 2,qera,65,0
>>> 6,kero,90,0
>>> 10,rosa,95,0
>>>
>>> what I would like to do is to update the rank position.
>>>
>>
>> update mytable set rank = (select count(*) from mytable t2 where
>> t2.score <= mytable.score);
>>
>
> Sorry, that should be        t2.score >= mytable.score
>
>
> --
> Igor Tandetnik
>
> ______________________________**_________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users>
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to