I have an SQL listing shops, but i would like to random the results on a daily basis.
For example today I list bat 2, 6, 9 etc and tomorrow, 6,1,7,9 etc
Is there a way to im开发者_运维技巧plement this?
With mysql you can write a query like this
select * from table order by rand(curdate()) limit 3
You can adapt it to other rdbms if you need.
Is this for a website or...?
You could set up a cron job to run a script on a daily basis and change something to make different shops show up.
For example, you could create a table that contains the ID numbers of shops you want to show, and when your cron job runs it would delete all records from that table and insert new ones, determined randomly or however you want.
精彩评论