SQL Server Rotary Records

Asked

Viewed 92 times

3

I would like to know how to select records rotationally from a table. For example I have a table called disclosure and I want the records to be selected in such a way that today brings the element x,y,z. Tomorrow, bring y,z,x. The next day z,x,y and so on. How to proceed?

  • How many records does the table have? The criterion is obviously the day, but you need to determine a starting day and a final one to make sense of the rotation. There is still the possibility of random select. Could define better?

  • The table does not have many records yet.. has approximately 20 thousand and they are filtered by categories but can be expanded. The starting date would always be the first day of the current week and the end the last day of the current week. I have never used Random select I am a layman in data access

  • 1

    See if it is more or less like this: http://answall.com/a/96472/70 - I would have to adapt the functions, but the logic might help - Here is a demo, you can open on different days that will always be starting on the current day of the week: http://sqlfiddle.com/#! 9/e3bfb/1

1 answer

1


You can create a column and play random values through the RAND function and sort through this column. Whenever you want to change the sort, just set new random values for this column.

  • Solved the problem thanks! I had to enter a job to run every two days and change the values of the column Random and sort them

Browser other questions tagged

You are not signed in. Login or sign up in order to post.