October 02, 2009

SQL Programming Random Message

SQL Programming Random Message

when we see a message on an application that will change when the refresh, then we think how to use it

SQL provides convenience through

SELECT RAND ();

example:
SELECT * FROM table ORDER BY RAND ();
SELECT * FROM table ORDER BY RAND () LIMIT 3;
SELECT * FROM table WHERE conditions ORDER BY RAND () LIMIT 3;

No comments:

Post a Comment

Let's us sharing

Recent Comment

Grab This Widget