Re: MySQL RAND() Issues [was Re: How to Shuffle data]

2011-07-15 Thread Reindl Harald
Am 15.07.2011 19:40, schrieb Jan Steinman: >> From: Reindl Harald >> >> do not use any random-functions of mysql even if they exists >> http://bugs.mysql.com/bug.php?id=59253 > > So RAND() can be useful, but it is not really very random the problem is the idiotic temp table fecth a random reco

Re: MySQL RAND() Issues [was Re: How to Shuffle data]

2011-07-15 Thread Dan Nelson
In the last episode (Jul 15), Arthur Fuller said: > This would be sooo much simpler to solve in MS-SQL, given the function > NewID(), which is guaranteed to return a unique value. I have used this > in a few web sites and it works splendidly; something along the lines of > > SELECT TOP 10 *, NewI

Re: MySQL RAND() Issues [was Re: How to Shuffle data]

2011-07-15 Thread Michael Dykman
I have found this approach pretty effective: select *, rand() r from [mytable] where [condition] order by r limit 10 as long as you are aware that a random number is generated for every row in the table. - michael dykman On Fri, Jul 15, 2011 at 2:12 PM, Arthur Fuller wrote: > This would

Re: MySQL RAND() Issues [was Re: How to Shuffle data]

2011-07-15 Thread Arthur Fuller
This would be sooo much simpler to solve in MS-SQL, given the function NewID(), which is guaranteed to return a unique value. I have used this in a few web sites and it works splendidly; something along the lines of SELECT TOP 10 *, NewID() FROM User_Messages ORDER BY NewID which is guaranteed to

Re: ANN: AnySQL Maestro 11.7 released

2011-07-15 Thread Jan Steinman
> SQL Maestro Group announces the release of AnySQL Maestro 11.7, a > powerful tool for managing any database engine accessible via ODBC > driver or OLE DB provider (MySQL, SQLite, PostgreSQL, SQL Server, > Oracle, Access, etc). And once again, despite at least two requests to clearly state platfo

MySQL RAND() Issues [was Re: How to Shuffle data]

2011-07-15 Thread Jan Steinman
> From: Reindl Harald > > do not use any random-functions of mysql even if they exists > http://bugs.mysql.com/bug.php?id=59253 Of course, it depends on the desired quality of randomness needed. I'm using RAND() to select random quotations to put at the end of emails. I can easily repeat the p

RE: Substring confusion.

2011-07-15 Thread Larry McGhaw
the new field - time - is a character field, length of 5, and your order by will sort the data as such - so "00:..." is before "03:..." The only reason why you don't have "00:.." times when you use a timestamp between and , is because there are no times that start with "00:" in the criteria .. th

Substring confusion.

2011-07-15 Thread Paul Halliday
Does anyone know why this happens: mysql> SELECT COUNT(*) AS count, SUBSTRING(timestamp,12,5) AS time FROM event WHERE timestamp BETWEEN '2011-07-15 03:00:00' AND '2011-07-16 02:59:59' GROUP BY time ORDER BY time limit 4; +---+---+ | count | time | +---+---+ | 5 | 03:00 | |

Efficient use of sub queries?

2011-07-15 Thread J B
I was wondering if any one could point out potential problems with the following query or if there was a better alternative >From a list of users I want to return all who don't have all the specified user_profile options or those who do not have at least one preference set to 1. The following quer