Hi
The first thought that comes to mind is getting hold of the relative record numbers of the "main" records and somehow linking each one, with the next main record
For example
Rec # Type
1 Main
2 Attrib
3 Attrib
4 Attrib
5 Main
Etc.
In this instance you need to end up with a file that has 2 fields
Main Rec # A Main rec # B
1 5
5 9
9 24
That way you can tell the range of attribute records
Now, how you get there is another question
Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Bill Howie
Sent: Wednesday, May 18, 2016 8:52 AM
To: midrange-l@xxxxxxxxxxxx
Subject: SQL statement to read previous records
Hello all,
I'm working on a project that requires the use of SQL. What I have is a situation where there can be a group of records in a file where the first record in a "set" of records is the "main" record and the subsequent records describe attributes of that "main" record. There is a record type field in this file which is used to differentiate between the main record and the "attribute" records. So what I'll have in the file is a "main"
record, then a bunch of "attribute" records, then another "main", then "attributes", and so on.
There is no field in the "attribute" record that links it back to the "main" record it goes with. The association between the two is simply the fact that the "attribute" record comes after the "main" record in the file.
Any thoughts from anyone on an ingenious way to use SQL to grab the "main" record? I think there has to be a way, just not coming up with it right now. Any help is appreciated! Thanks!
Bill
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
As an Amazon Associate we earn from qualifying purchases.