I'm trying to use RAND to return my result set in a different order each time it is executed.
Am I off base on this on this approach?
This is my query, which returns the same data in the same order every time it runs.
-----------------------
alter PROCEDURE DBO.hh_Event_GetFeatured
@OrganizationId int
AS
--------------------------
----------
----------
----------
----------
----------
---------
/* Step 1 Get all approved featured events for the organization specified. */
--------------------------
----------
----------
----------
----------
----------
---------
SELECT T1.*,
T2.*
FROM HOMEHOSTING_FEATUREDEVENTS
T1
JOIN HOMEHOSTING_EVENTS T2 ON T1.EVENTID = T2.ID
WHERE T1.ISAPPROVED = 1
AND T2.[Date] > GetDate()
AND T2.ORGANIZATIONID = @OrganizationId
ORDER BY RAND()
Start Free Trial