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
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 |
|
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 today at 3am and tomorrow at 3am,
is because there are no times that start with 00:
From: Reindl Harald h.rei...@thelounge.net
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
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 platform
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
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
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 *, NewID()
Am 15.07.2011 19:40, schrieb Jan Steinman:
From: Reindl Harald h.rei...@thelounge.net
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