On 15 Jan 2013, at 1:58pm, Ryan Johnson wrote:
> On 14/01/2013 9:48 AM, François-xavier Jacobs wrote:
>> i would like to "seed random" a request, so i could do use some pagination
>> system with a order by random(), is this possible sqlite ? when a tried to
>> use
Indeed shuffle was my goal
i solve it by doing order by "((rowid * "+seed.longValue()+" ) %
"+BIG_PRIME_NUMBER+")";
as long ass the seed doe not change result is the same, so i can shuffle
with LIMT
Regards
2013/1/15 Ryan Johnson
> On 14/01/2013 9:48 AM,
François-xavier Jacobs wrote:
> when a tried to use "order by 1234567892" it always return the same order
Because this is the *same* value for all records.
> i would like to "seed random" a request, so i could do use some pagination
> system with a order by random(), is this possible sqlite ?
On 1/14/2013 9:48 AM, François-xavier Jacobs wrote:
i would like to "seed random" a request, so i could do use some pagination
system with a order by random(), is this possible sqlite ? when a tried to
use "order by 1234567892" it always return the same order
random() returns a different value
If you literally used "ORDER BY 1234567892" then there's nothing in the record
being sorted.
I can't recall is SQLite allows order by aliases, but something like..
Select ..., random() as X
Order by X
Might work, as long as random() is executed for each row.
(Sorry.. don't have a quick SQLite
On 14/01/2013 9:48 AM, François-xavier Jacobs wrote:
Hi everyone
i would like to "seed random" a request, so i could do use some pagination
system with a order by random(), is this possible sqlite ? when a tried to
use "order by 1234567892" it always return the same order
That's because you
Hi everyone
i would like to "seed random" a request, so i could do use some pagination
system with a order by random(), is this possible sqlite ? when a tried to
use "order by 1234567892" it always return the same order
___
sqlite-users mailing list
7 matches
Mail list logo