This is a discussion on "Random records.." within the Databases section. This forum, and the thread "Random records.. are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Random records..
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Random records..
I was looking for a way to select random records from a SQL database and come across this little beauty..
This basically selects 5 random records from a table which you can then iterate through, bung in a recordset, etc... This was done on MsSql, and should work on MySql and Access. Just sharing... u2o |
|
|
|
#2
|
||||
|
||||
|
Hi U2.... yeah, I use that a lot.
Doesn't work in access though to my knowledge. Actually.... I'm gonna add this to the Articles Area.
__________________
Click the 'Thanks!' button if this post has helped you Rob - Webforumz Founder
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
#3
|
|||
|
|||
|
tried it in Access, get the error:
Undefined function 'NewID()' in expression Im sure theres an easy way to do this in Access tho. |
|
#4
|
|||
|
|||
|
Not that easily there isn't.
Could use getRows and then output an array element based on a random number. But I don't think you can do it in a SQL statement Or maybe get your recordset and then objRS.Move to a record between 1 and recordcount. |
|
#5
|
|||
|
|||
|
Yeah, sure you can.. I did it in an article for Rob on this very subject. I am not quite sure when the article is going to be posted, see Rob...
u2o |
|
#6
|
||||
|
||||
|
THe article has been added to the portal (Version 2)
Smokie... as you are an admin, you already hae access to this. Check it out.
__________________
Click the 'Thanks!' button if this post has helped you Rob - Webforumz Founder
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
#7
|
|||
|
|||
|
nice one
|
![]() |
| Tags |
| random, records |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Array Multiple records | jfergy | Classic ASP | 6 | Jan 17th, 2006 16:44 |
| ASP show records in random order | therese | Classic ASP | 1 | Jul 7th, 2005 09:34 |
| reversing records | benbacardi | Classic ASP | 2 | Sep 4th, 2004 16:59 |
| Delete Specific Records | ekendricks | Databases | 1 | Mar 8th, 2004 05:23 |
| Appending multiple records | jakyra | Classic ASP | 0 | Sep 8th, 2003 19:33 |