SQL Server--> SELECT TOP 50 * FROM TAB_USERS ORDER BY NEWID();
ORACLE--> SELECT * FROM (SELECT * FROM TAB_USERS ORDER BY DBMS_RANDOM.RANDOM()) WHERE RONUM<=50
MYSQL--> SELECT * FROM TAB_USERS ORDER BY RAND() LIMIT 50
{
ACCESS--> SELECT TOP 50 * FROM TAB_USERS ORDER BY RND([字段])
這條語句在ACCESS中的查詢結果是正確的,但在ASP.NET等後台代碼要寫成如下:
Random random=new Random(System.Guid.NewGuid().GetHashCode());
int val=random.Next();
string sql="SELECT TOP 50 * FROM TAB_USERS ORDER BY RND("+(-r)+"字段)";
}