newid()

代码

select   top   5   *   from   ItemProfileCommonInfo   order   by   newid()   

set statistics profile on
SET NOCOUNT ON;
select  top 6   a.[name],a.description,a.categoryid from dbo.ItemProfileCommonInfo a with(nolock)
where  a.Editdate>(getdate() -100and  a.categoryid in (select categoryid from ItemCategory with(nolock) where description like N'%%' 
or description like N'%%')
order by newid()




select  top 6   a.itemcode,a.[description],b.PriceFinal,a.ImageNameFull from ItemProfileCommonInfo a with(nolock)
 
join ItemProfilePriceSetting b with(nolock) on a.itemcode=b.itemcode 
where  a.Editdate>(getdate() -100and  a.categoryid in (select categoryid from ItemCategory with(nolock) where description like N'%%' 
or description like N'%%')
order by newid()
原文地址:https://www.cnblogs.com/duwamish/p/1732556.html