Re: Random sort via SQL in ASP
- From: "muskie" <google@xxxxxxxxxxxxxxxx>
- Date: 12 Apr 2007 21:49:26 -0700
On Apr 12, 10:40 pm, eng...@xxxxxxxxxxxx wrote:
On Apr 12, 9:13 pm, eng...@xxxxxxxxxxxx wrote:
On Apr 12, 7:33 pm, "muskie" <goo...@xxxxxxxxxxxxxxxx> wrote:
I've looked through as many posts about this as possible, but all end
with no resolution. I simply need records from a table in random
order, and I will be calling this recordset in a SQL statement from
ASP. I've tried the following but it does not produce random order:
SELECT * FROM Table1 ORDER BY Rnd(TableID) ASC;
where TableID is an autonumber field.
I've seen references to Randomize, but how do you use Access's
randomize from ASP?
Does anyone know of a simple solution for this?
Thanks,
Matt
I'd be surprised if you can use this in SQL using the method you are
trying. I'd write some code that you can trigger that puts a random
number in a field (e.g. sortfield as long) in the table. Then you can
select and order by that random field (e.g. ORDER BY sortfield). This
will certainly get the job done. Whenever you want a different
randomizing, then trigger the code.
-- Larry Engles- Hide quoted text -
- Show quoted text -
If you have an autonumber feild, you could use that in the query (e.g.
ORDER BY (autonumberField).
-- Larry Engles
Thanks Larry, I appreciate the input...
If I run my query in Access it works to produce a randomly sorted
recordset. If I run the exact same query from my ASP it does not.
Any idea why this happens?
.
- Follow-Ups:
- Re: Random sort via SQL in ASP
- From: Tom van Stiphout
- Re: Random sort via SQL in ASP
- References:
- Random sort via SQL in ASP
- From: muskie
- Re: Random sort via SQL in ASP
- From: engles
- Re: Random sort via SQL in ASP
- From: engles
- Random sort via SQL in ASP
- Prev by Date: Re: Random sort via SQL in ASP
- Next by Date: Re: Is it possible to determine the record ID when using INSERT INTO?
- Previous by thread: Re: Random sort via SQL in ASP
- Next by thread: Re: Random sort via SQL in ASP
- Index(es):
Relevant Pages
|