2017-09-05 13:55 GMT+02:00 Hick Gunter <h...@scigames.at>:

> Try 250E15. Just 1 constant instead of 6 constants and 5 multiplication
> operations (for each and every row).
>

​Strange: I thought I did something like that, but maybe I did something
wrong.
Is quit a while back, so I do not know what I did exactly.

It gives a  float instead of an integer, but that is in my case not a
problem.
​
​If it will become a proclem I always can use CAST.

I just changed it to: 2.5E17.
​



> -----Ursprüngliche Nachricht-----
> Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> Im Auftrag von Cecil Westerhof
> Gesendet: Dienstag, 05. September 2017 13:49
> An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
> Betreff: [EXTERNAL] [sqlite] Better way to use a large constant
>
> I have the following query:
> SELECT   *
> ,        abs(random()) / (250 * 1000 * 1000 * 1000 * 1000 * 1000) + 1 AS
> randomiser
> FROM     stock
> ORDER BY randomiser + julianday("Last Used")
> LIMIT    <SOME VALUE>
>
> I prefer to use something I never used or long ago. That is why I use the
> random. Randomiser gives a value between 1 and 37.
>
> I use:
>     (250 * 1000 * 1000 * 1000 * 1000 * 1000) because I find that more
> clear as:
> ​    250000000000000000​
>
> ​But is there a better way?​
>

-- 
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to