sql-server – SQL Server rotating records

Question:

I would like to know how to select records on a rotating basis 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 I have the element x,y,z. Tomorrow, bring y,z,x. The next day z,x,y and so on. How to proceed?

Answer:

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

Scroll to Top