Hi all,
I've never done random row selections before, but the need has come.
Basic scenario:
MS SQL Server 2000
table1 = users
table2 = postings
table1.ID = table2.USER_ID is a decimal.
table2.DATE_POSTED is a date format
Result needed is a table of the postings but:
- only one record from each user to show in every 20 records
- only show records within last 90 days of post date to now.
Once the result has come back, I'd like to use it in ASP and paginate through it.
Currently the database has like 5000 records, probably an approximately 1000 records would be an appropriate data returned.
The random factor is to display the returned rows in random order, not by post date.
While this normally would be against useful logic, there is a reason for this madness, and that is to ensure displayed records are random, and not one user floods the returned set in one screen. Each post is an advertisement, unrelated to other posts.
Any and all help is much appreciated! Thanks!
-Peter
I've never done random row selections before, but the need has come.
Basic scenario:
MS SQL Server 2000
table1 = users
table2 = postings
table1.ID = table2.USER_ID is a decimal.
table2.DATE_POSTED is a date format
Result needed is a table of the postings but:
- only one record from each user to show in every 20 records
- only show records within last 90 days of post date to now.
Once the result has come back, I'd like to use it in ASP and paginate through it.
Currently the database has like 5000 records, probably an approximately 1000 records would be an appropriate data returned.
The random factor is to display the returned rows in random order, not by post date.
While this normally would be against useful logic, there is a reason for this madness, and that is to ensure displayed records are random, and not one user floods the returned set in one screen. Each post is an advertisement, unrelated to other posts.
Any and all help is much appreciated! Thanks!
-Peter