Array help

  • Thread starter TGP Thought Meister
  • Start date
T

TGP Thought Meister

Need some help with an array problem.

I am pulling several rows from my database and placing them into an array
successfully but I want to be able to pull them randomly. I can't decide the
best way to proceed, whether to create another array with the DB ID's and
then run a check each time I generate a random number against this array? Or
should I delete the record from the array each time through with the random
number?

Any ideas?
 
D

Dave Anderson

TGP Thought Meister said:
I am pulling several rows from my database and placing them into
an array successfully but I want to be able to pull them randomly...

Depending on your database, you could simply return the records in random
order. In SQL Server, for example, you could use the following:

SELECT ... ORDER BY NEWID()


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top