RE: Can you use random(*) to retrieve a pseudo random rowfrom 3.2.3?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RE: Can you use random(*) to retrieve a pseudo random rowfrom 3.2.3?

Brandon, Nicholas (UK)


>Your logic is broken. As every of your row's start_col is less than
>end_row, the result set will be empty for every possible value of
>rand.number.
>Don't even know what you expected to get with this query.

Prize to Jacob for spotting the (now) obviously mistake.

The following SQL works successfully:

sqlite> select * from MyTable join (select random(*) as number) as rand
where rand.number between start_col AND end_col;

Many Thanks
Nick

********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************