[MonetDB-users] How to select random resords from MonetDB
How to select random resords from MonetDB? Thanks! lonefs 2007-08-30
On Thu, Aug 30, 2007 at 03:14:39PM +0800, lonefs wrote:
How to select random resords from MonetDB?
Using the RAND() /SRAND() functions you could create random numbers. Depending on your schema you may select random records. Niels
Thanks!
_________________________________________________________
lonefs
2007-08-30
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl
I have tried rand(), and my sql is: SELECT table.field, rand() AS r FROM tablename WHERE condition ORDER BY r LIMIT 10; However, in the entire select process, I get the same rand() value, it seems that in the entire process, rand() is only executed once. If I use: SELECT tablename.field, rand() FROM tablename WHERE condition LIMIT 10; I can get different rand() value, but I cannot reference the rand() field. Finally I use this, it seems OK now: SELECT * FROM (SELECT tablename.field, rand() FROM tablename WHERE condition) AS t(table.field, r) ORDER BY r LIMIT 10; lonefs 2007-08-31 发件人: Niels Nes 发送时间: 2007-08-31 00:55:37 收件人: Communication channel for MonetDB users 抄送: 主题: Re: [MonetDB-users] How to select random resords from MonetDB On Thu, Aug 30, 2007 at 03:14:39PM +0800, lonefs wrote:
How to select random resords from MonetDB?
Using the RAND() /SRAND() functions you could create random numbers. Depending on your schema you may select random records. Niels
Thanks!
_________________________________________________________
lonefs
2007-08-30
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now > > http://get.splunk.com/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now > > http://get.splunk.com/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
participants (2)
-
lonefs
-
Niels Nes