如何使用SQL查询以随机顺序显示数据

时间:2013-03-07 08:03:36

标签: sql-server data-binding datalist

这是绑定到我的DataList的SQL查询。你能告诉我如何以随机顺序返回数据吗?

SELECT
   CONVERT(varchar(6), a.lastdate, 6) as lastdate, * 
FROM
   alz_jobpost AS a 
INNER JOIN
   (SELECT * 
    FROM alzome_SuperAdmin AS b 
    INNER JOIN alzome_Renewal AS c ON b.S_id = c.supid 
    WHERE c.product = 'HI-TOUCH' AND c.Payed = 1) AS aa ON a.oid=aa.businessid 
WHERE
   a.status = 1 
   AND a.lastdate > GETDATE() 
ORDER BY 
   a.startdate DESC

1 个答案:

答案 0 :(得分:2)

要以随机顺序获取结果,您可以更改:

ORDER BY a.startdate DESC

类似于:

ORDER BY NEWID()