× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Alan,

Create an artificial key using the SQL RRN() function. Set a new key field to ( RRN(table) * 2 - 1 ) for the A records and
( RRN(table) * 2 - (count of A records) ) for the B records then reorder on the new key field.

If you have to sequence based on the timestamp and there is room in between the A timestamp records then set the B timestamps to a corresponding A timestamp plus a small increment (Second? Microsecond?). Use the RRN() function with an offset to link a B record to a corresponding A record RRN() you want it to follow.

Paul Morgan

Principal Programmer Analyst
IS Supply Chain/Replenishment

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Shore
Sent: Monday, August 09, 2010 2:30 PM
To: Midrange Systems Technical Discussion
Subject: Re: Using SQL to "mix" the records in a file


As soon as I pressed Enter, I wasn't too sure that I had explained myself
So here is my second attempt
The file contains 1,000 records, by timestamp, but as it happens, the first
500 are record types A and the second 500 are record types B (by timestamp)

I need to change the timestamp so that the 2 types are mingled
A
B
A
B
A
B

by timestamp

Hopefully that makes it a little clearer

Again, thanks in advance


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.