Bob Schneider
asked on
Weighted Randomizing
I have a series of 12 running events that I am giving "featured event" status. The problem is that some of them are coming up this spring and some are not coming up until the fall. I would like to find the most efficient way to pull their data "randomly" with extra emphasis given to the events that happen soonest. Not that I would not have the others appearing...just that they would have a lower likelihood.
With no weighting I was doing this:
I am looking at a process that would select from 1 to 5 of these events as indicated above and be light on the processing.
With no weighting I was doing this:
sql = "SELECT FeaturedEventsID, EventName, EventDate, Location, WebURL, Descr, BlockImage, Views FROM FeaturedEvents WHERE (EventDate BETWEEN '" & Date
sql = sql & "' AND '" & Date + 360 & "') AND Active = 'y' ORDER BY NewID()"
I am looking at a process that would select from 1 to 5 of these events as indicated above and be light on the processing.
Not enough information. Please provide sample data and sample expected output. Thanks.
ASKER
I am attaching a file of the data as it stands right now. I want to pull 1 to 5 of these out "randomly" but I want to give more weight to those that are coming up sooner than those that re coming up later. And I need it to process as quickly as possible because there is a significant amount of traffic during high peak site usage, which is when these will be appearing most often.featured_events.docx
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm getting this message in sql server when I try to run a view with this: Invalid parameter 1 specified for datediff
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect! Thank you!!!