|
You're getting closer, but your method does not guarantee that a
record will actually exist in the table which bears a PK number
matching one in your random integers list. Records can get deleted,
no? Run a query for the past 2 weeks, but select JUST the ID numbers. Use the valueList() function to build a list from that, then loop and use the rndRange(1,listLen()) functions to build your target list of 20 winners. Do the full query (WHERE IN) from that. Al On 3/21/2011 2:44 PM, Jason King wrote: I'm using MS-SQL, and there's no 'limit' function. So at this point I'm using CFQUERY's maxrows to limit the results. However, I believe that the query is still grabbing more than 20 rows (being that I want 20 random ads), it's just that it's being limited to 20 AFTER the query has run.-- official tag/function reference: http://openbd.org/manual/ mailing list - http://groups.google.com/group/openbd?hl=en |
- Re: [OpenBD] Best way to randomize results from cfsearch ... Alan Holden
- Re: [OpenBD] Best way to randomize results from cfsearch ... Matthew Woodward
- Re: [OpenBD] Best way to randomize results from cfse... Alan Holden
- Re: [OpenBD] Best way to randomize results from cfse... Jason King
- Re: [OpenBD] Best way to randomize results from ... Jason King
- Re: [OpenBD] Best way to randomize results from ... Matthew Woodward
- [OpenBD] Re: Best way to randomize results from cfsearch ... ben.8
- [OpenBD] Re: Best way to randomize results from cfse... Craig328
- Re: [OpenBD] Re: Best way to randomize results f... Jason King
- Re: [OpenBD] Re: Best way to randomize resul... Matthew Woodward
- Re: [OpenBD] Re: Best way to randomize resul... Alan Holden
- Re: [OpenBD] Re: Best way to randomize resul... Nitai @ Razuna
