Return comination of Current record and next record fields

E

efandango

I have a table:

Run_point_List_ID 1 (Autonumber)
Run_point_Venue_A
Run_point_Venue_B
Run_point_Venue_C
Run_point_Venue_D


How can I get the query to return the first two fields from the 1st record
and the second two fields from the 2nd record, and so on... like the example
below?


From Record 1 From Record 1 From Record 2 From Record 2
From Record 2 From Record 2 From Record 3 From Record 3
From Record 3 From Record 3 From Record 4 From Record 4
From Record 4 From Record 4 From Record 5 From Record 5
From Record 5 From Record 5 From Record 6 From Record 6



Run_point_List_ID
1 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C Run_point_Venue_D
Run_point_List_ID
2 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C Run_point_Venue_D
Run_point_List_ID
3 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C Run_point_Venue_D
Run_point_List_ID
4 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C Run_point_Venue_D
 
J

John Spencer

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A INNER JOIN Run_Point as B
On A.Run_Point_List_ID = B.Run_Point_List_ID +1

That will work as long as Run_Point_List_ID is sequential with NO gaps.

If you have gaps then life gets more complex as you will have to calculate
the next higher number. That Might look something like the following.

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A , Run_Point as B
WHERE B.Run_Point_List_ID =
(SELECT Min(Tmp.Run_Point_List_ID)
FROM Run_Point as Tmp
WHERE Tmp.Run_Point_List_ID > A.Run_Point_List_ID)


--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
E

efandango

John,

That is great, but not quite working the way I figured.

The 2nd half of the 1st segment is missing, as in an 'odd man out' kind of
way, where the very first record's 2nd half is (naturally) displaced by the
next records' 1st half. I'm just trying to take in all the permutations, as
there are even more fields that I have added, and i'm trying to get my head
round a screen full of data rows now.

I didn't show the additonal fields in my first post as I didn't want to make
extra work for someone such as yourself. They follow the same pattern as the
original fields, just that they go from A-H (first half) I-P (2nd half) of
each record. in all a total of 16 fields laid out spreadsheet style. So, once
I really get my head around what's what, can I come back to you on this?
(will you get email notification from my response?)
 
J

John Spencer

No, I won't get notified if you post additional messages to this thread. I
usually keep an eye out, but I have been known to miss a followup.

Which solution did you use? You are always going to be missing half of the
fields in either the first record or the last record.

If you would rather the last record is unmatched then you need to modify the
two queries - whichever one you are using

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A INNER JOIN Run_Point as B
On A.Run_Point_List_ID = B.Run_Point_List_ID - 1 <<<<<<< minus 1 instead
of plus 1

Max and Less than instead of Min and greater than in the subquery.

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A , Run_Point as B
WHERE B.Run_Point_List_ID =
(SELECT Max(Tmp.Run_Point_List_ID)
FROM Run_Point as Tmp
WHERE Tmp.Run_Point_List_ID < A.Run_Point_List_ID)

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
E

efandango

John,

ultimately Your solution was great, I made adjustments (due to my lack of
foresight), but bottom line, you answered my call for help (I was truly
stumped), and it worked. Yes, I will lose half the first or last records, but
that doesn't matter.

Here is what I now have:

SELECT A.Run_Point_List_ID, A.Run_No,


A.Run_point_Venue_X2,
A.Run_point_Address_X2,
A.Run_Point_Venue_I,
A.Run_Point_Address_I,
A.Run_Point_Venue_J,
A.Run_Point_Address_J,
A.Run_Point_Venue_K,
A.Run_Point_Address_K,
A.Run_Point_Venue_L,
A.Run_Point_Address_L,
A.Run_Point_Venue_M,
A.Run_Point_Address_M,
A.Run_Point_Venue_N,
A.Run_Point_Address_N,
A.Run_Point_Venue_O,
A.Run_Point_Address_O,
A.Run_Point_Venue_P,
A.Run_Point_Address_P,



B.Run_point_Venue_X1,
B.Run_point_Address_X1,
B.Run_Point_Venue_A,
B.Run_Point_Address_A,
B.Run_Point_Venue_B,
B.Run_Point_Address_B,
B.Run_Point_Venue_C,
B.Run_Point_Address_C,
B.Run_Point_Venue_D,
B.Run_Point_Address_D,
B.Run_Point_Venue_E,
B.Run_Point_Address_E,
B.Run_Point_Venue_F,
B.Run_Point_Address_F,
B.Run_Point_Venue_G,
B.Run_Point_Address_G,
B.Run_Point_Venue_H,
B.Run_Point_Address_H


FROM tbl_Points AS A INNER JOIN tbl_Points AS B
ON B.Run_Point_List_ID=A.Run_Point_List_ID+1;


Which is ok, but what I would realy like if possible is for the 2nd half
fields be renamed to the first half, and vice-versa. so that ultimately
Run_Point_Venue_I becomes Run_Point_Venue_A
Run_Point_Venue_J becomes Run_Point_Venue_B
Run_Point_Venue_K becomes Run_Point_Venue_C
Run_Point_Venue_L becomes Run_Point_Venue_D
and so on...

the reason for this is that I have lots of predefined forms & reports that
used the old/original field orders which is going to take a long time to copy
and refomat, In an Ideal world it would be great to use the same Forms &
Reports and not have to maintain two different copies of each, instead just
perhaps having a button, or some other mechanism to switch the SQL source.
 
E

efandango

John, (after some sage advice from John W. Vinson, I have changed the table
somewhat and was wondering...

Can you help with this?...

I want to find a similar solution thing to the previous problem, but the key
difference here is that the 18 sets of fields are not seperated into 18
seperate fields, but have been normalized/consolidated into 1 field for Venue
and 1 for Address, but each set is held 'in order' by a [OrderSeq] field that
has a maximum of 18 per set of addresses.


The similar solution being I want to take the last 9 records (of each
OrderSeq) and marry them up with the first 9 records of the next set of 18.

For example:

Run_No 1 (last 9)
Run_No 2 (first 9)
and so on...


My table: (tbl_Points) looks like this:


Run_No (Master Field)
Point_ID (Primary Key)
OrderSeq (Number) orders the address list sequence)
Run_point_Venue (Text
Run_point_Address (Text)


From a user's point of view, the records are broken down into sets of 18,
denoted by a master field, Run_No. They are essentially ordered by the
[OrderSeq] field.


Sample records go like this:

Run_No Point_ID OrderSeq Run_point_Venue Run_point_Address
1
1 377 2 De Vere Hotel 1 Aldwych
1 377 3 London Shelton Hotel Chancel Street
1 377 4 Costello Palace Hotel Lavington Street
1 377 ...18 Hilton Hotel Tower Bridge Savoy Court

2 378 1 Bruebaker Hotel 10 John Adam Street
2 378 2 Parkside Hotel N4 Cheney Road
2 378 3 Elena Hotel Leicester Square
2 378 ...18 Hilton Tower Bridge Hotel Savoy Place

3 379 1 Celstion Hotel 18 Northumberland Avenue
3 379 2 Pembury Hotel Drury Lane
3 379 3 Eric Hotel Lennox Road
3 379 ...18 Holiday Inn Express SE1 Seven Sisters Road
 
J

John Spencer

To get the last nine to match one for one to the first nine of the next
group, you would need something like the following.

SELECT A.Run_No, B.Run_No
, A.Point_ID, B.Point_ID
, A.OrderSeq, B.OrderSeq
FROM RunTable as A INNER JOIN RunTable as B
ON A.Run_No + 1 = B.Run_No
AND A.OrderSeq - 9 = B.OrderSeq

By the way, Point_ID cannot be the primary key since by definition no
two records can have the same value for the primary key field.

If I understood correctly, that should return
1,2,377,378,10,1
1,2,377,378,11,2
1,2,377,378,12,3
....


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

John, (after some sage advice from John W. Vinson, I have changed the table
somewhat and was wondering...

Can you help with this?...

I want to find a similar solution thing to the previous problem, but the key
difference here is that the 18 sets of fields are not seperated into 18
seperate fields, but have been normalized/consolidated into 1 field for Venue
and 1 for Address, but each set is held 'in order' by a [OrderSeq] field that
has a maximum of 18 per set of addresses.


The similar solution being I want to take the last 9 records (of each
OrderSeq) and marry them up with the first 9 records of the next set of 18.

For example:

Run_No 1 (last 9)
Run_No 2 (first 9)
and so on...


My table: (tbl_Points) looks like this:


Run_No (Master Field)
Point_ID (Primary Key)
OrderSeq (Number) orders the address list sequence)
Run_point_Venue (Text
Run_point_Address (Text)


From a user's point of view, the records are broken down into sets of 18,
denoted by a master field, Run_No. They are essentially ordered by the
[OrderSeq] field.


Sample records go like this:

Run_No Point_ID OrderSeq Run_point_Venue Run_point_Address
1
1 377 2 De Vere Hotel 1 Aldwych
1 377 3 London Shelton Hotel Chancel Street
1 377 4 Costello Palace Hotel Lavington Street
1 377 ...18 Hilton Hotel Tower Bridge Savoy Court

2 378 1 Bruebaker Hotel 10 John Adam Street
2 378 2 Parkside Hotel N4 Cheney Road
2 378 3 Elena Hotel Leicester Square
2 378 ...18 Hilton Tower Bridge Hotel Savoy Place

3 379 1 Celstion Hotel 18 Northumberland Avenue
3 379 2 Pembury Hotel Drury Lane
3 379 3 Eric Hotel Lennox Road
3 379 ...18 Holiday Inn Express SE1 Seven Sisters Road



John Spencer said:
No, I won't get notified if you post additional messages to this thread. I
usually keep an eye out, but I have been known to miss a followup.

Which solution did you use? You are always going to be missing half of the
fields in either the first record or the last record.

If you would rather the last record is unmatched then you need to modify the
two queries - whichever one you are using

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A INNER JOIN Run_Point as B
On A.Run_Point_List_ID = B.Run_Point_List_ID - 1 <<<<<<< minus 1 instead
of plus 1

Max and Less than instead of Min and greater than in the subquery.

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A , Run_Point as B
WHERE B.Run_Point_List_ID =
(SELECT Max(Tmp.Run_Point_List_ID)
FROM Run_Point as Tmp
WHERE Tmp.Run_Point_List_ID < A.Run_Point_List_ID)

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
E

efandango

John,

That is so nearly there, well so far your SQL has succesfully put them all
into the correct order, but I could only see the various record, Id, etc
numbers on the query result, so I added the text fields like this:

SELECT A.Run_No, B.Run_No, A.Point_ID, B.Point_ID, A.OrderSeq, B.OrderSeq,
A.Run_point_Venue,
A.Run_point_Address,
B.Run_point_Venue,
B.Run_point_Address
FROM tbl_Points as A INNER JOIN tbl_Points as B
ON A.Run_No + 1 = B.Run_No
AND A.OrderSeq - 9 = B.OrderSeq

WHICH gives me this:

A.Point_ID A.Run_point_Venue A.Run_point_Address A.OrderSeq A.Run_No B.Run_No B.Point_ID B.OrderSeq B.Run_point_Venue B.Run_point_Address
11 De Vere Hotel 1 Aldwych 10 1 2 19 1 Hilton Hotel Tower Bridge Savoy Court
10 London Shelton Hotel Chancel Street 11 1 2 20 2 Bruebaker Hotel 10 John
Adam Street
12 Costello Palace Hotel Lavington Street 12 1 2 21 3 Parkside Hotel
N4 Cheney Road


BUT what I need is for the B.Run_Point_Venue and B.Run_point_Address to
merge with the A.Run_Point_Venue and A.Run_point_Address respectively, with
the B.Run_Point_Venue going before the A.Run_Point_Venue.

So that I end up with the fields and records like this:

Run_No Point_ID OrderSeq Run_point_Venue Run_point_Address
2 19 1 Hilton Hotel Tower Bridge Savoy Court
2 20 2 Bruebaker Hotel 10 John Adam Street
2 21 3 Parkside Hotel N4 Cheney Road
2 11 10 De Vere Hotel 1 Aldwych
2 10 11 London Shelton Hotel Chancel Street
2 12 12 Costello Palace Hotel Lavington Street





John Spencer said:
To get the last nine to match one for one to the first nine of the next
group, you would need something like the following.

SELECT A.Run_No, B.Run_No
, A.Point_ID, B.Point_ID
, A.OrderSeq, B.OrderSeq
FROM RunTable as A INNER JOIN RunTable as B
ON A.Run_No + 1 = B.Run_No
AND A.OrderSeq - 9 = B.OrderSeq

By the way, Point_ID cannot be the primary key since by definition no
two records can have the same value for the primary key field.

If I understood correctly, that should return
1,2,377,378,10,1
1,2,377,378,11,2
1,2,377,378,12,3
....


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

John, (after some sage advice from John W. Vinson, I have changed the table
somewhat and was wondering...

Can you help with this?...

I want to find a similar solution thing to the previous problem, but the key
difference here is that the 18 sets of fields are not seperated into 18
seperate fields, but have been normalized/consolidated into 1 field for Venue
and 1 for Address, but each set is held 'in order' by a [OrderSeq] field that
has a maximum of 18 per set of addresses.


The similar solution being I want to take the last 9 records (of each
OrderSeq) and marry them up with the first 9 records of the next set of 18.

For example:

Run_No 1 (last 9)
Run_No 2 (first 9)
and so on...


My table: (tbl_Points) looks like this:


Run_No (Master Field)
Point_ID (Primary Key)
OrderSeq (Number) orders the address list sequence)
Run_point_Venue (Text
Run_point_Address (Text)


From a user's point of view, the records are broken down into sets of 18,
denoted by a master field, Run_No. They are essentially ordered by the
[OrderSeq] field.


Sample records go like this:

Run_No Point_ID OrderSeq Run_point_Venue Run_point_Address
1
1 377 2 De Vere Hotel 1 Aldwych
1 377 3 London Shelton Hotel Chancel Street
1 377 4 Costello Palace Hotel Lavington Street
1 377 ...18 Hilton Hotel Tower Bridge Savoy Court

2 378 1 Bruebaker Hotel 10 John Adam Street
2 378 2 Parkside Hotel N4 Cheney Road
2 378 3 Elena Hotel Leicester Square
2 378 ...18 Hilton Tower Bridge Hotel Savoy Place

3 379 1 Celstion Hotel 18 Northumberland Avenue
3 379 2 Pembury Hotel Drury Lane
3 379 3 Eric Hotel Lennox Road
3 379 ...18 Holiday Inn Express SE1 Seven Sisters Road



John Spencer said:
No, I won't get notified if you post additional messages to this thread. I
usually keep an eye out, but I have been known to miss a followup.

Which solution did you use? You are always going to be missing half of the
fields in either the first record or the last record.

If you would rather the last record is unmatched then you need to modify the
two queries - whichever one you are using

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A INNER JOIN Run_Point as B
On A.Run_Point_List_ID = B.Run_Point_List_ID - 1 <<<<<<< minus 1 instead
of plus 1

Max and Less than instead of Min and greater than in the subquery.

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A , Run_Point as B
WHERE B.Run_Point_List_ID =
(SELECT Max(Tmp.Run_Point_List_ID)
FROM Run_Point as Tmp
WHERE Tmp.Run_Point_List_ID < A.Run_Point_List_ID)

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

John,

That is great, but not quite working the way I figured.

The 2nd half of the 1st segment is missing, as in an 'odd man out' kind of
way, where the very first record's 2nd half is (naturally) displaced by
the
next records' 1st half. I'm just trying to take in all the permutations,
as
there are even more fields that I have added, and i'm trying to get my
head
round a screen full of data rows now.

I didn't show the additonal fields in my first post as I didn't want to
make
extra work for someone such as yourself. They follow the same pattern as
the
original fields, just that they go from A-H (first half) I-P (2nd half) of
each record. in all a total of 16 fields laid out spreadsheet style. So,
once
I really get my head around what's what, can I come back to you on this?
(will you get email notification from my response?)


:

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A INNER JOIN Run_Point as B
On A.Run_Point_List_ID = B.Run_Point_List_ID +1

That will work as long as Run_Point_List_ID is sequential with NO gaps.

If you have gaps then life gets more complex as you will have to
calculate
the next higher number. That Might look something like the following.

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A , Run_Point as B
WHERE B.Run_Point_List_ID =
(SELECT Min(Tmp.Run_Point_List_ID)
FROM Run_Point as Tmp
WHERE Tmp.Run_Point_List_ID > A.Run_Point_List_ID)


--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

I have a table:

Run_point_List_ID 1 (Autonumber)
Run_point_Venue_A
Run_point_Venue_B
Run_point_Venue_C
Run_point_Venue_D


How can I get the query to return the first two fields from the 1st
record
and the second two fields from the 2nd record, and so on... like the
example
below?


From Record 1 From Record 1 From Record 2 From Record 2
From Record 2 From Record 2 From Record 3 From Record 3
From Record 3 From Record 3 From Record 4 From Record 4
From Record 4 From Record 4 From Record 5 From Record 5
From Record 5 From Record 5 From Record 6 From Record 6



Run_point_List_ID
1 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C
Run_point_Venue_D
Run_point_List_ID
2 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C
Run_point_Venue_D
Run_point_List_ID
3 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C
Run_point_Venue_D
Run_point_List_ID
4 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C
Run_point_Venue_D
 
J

John Spencer

I really don't understand the results you want. It seems like you are
saying that you want a sort order of the records so that they appear in
a certain order.

I was pairing the records together in one result.

You will have to play around a bit with Point_ID and OrderSeq

The basic idea would be something like:

SELECT Run_No, Point_Id, OrderSeq
, Run_Point_Venue
, Run_Point_Address
FROM tbl_Points
ORDER BY IIF(OrderSeq > 9, Run_No, Run_No-1), OrderSeq

I'm not sure that will give you what you want, but you should be able to
experiment a bit to get what you are attempting. It might be that you
need to add 1 instead of subtract 1 or that ...

Good luck

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

John,

That is so nearly there, well so far your SQL has succesfully put them all
into the correct order, but I could only see the various record, Id, etc
numbers on the query result, so I added the text fields like this:

SELECT A.Run_No, B.Run_No, A.Point_ID, B.Point_ID, A.OrderSeq, B.OrderSeq,
A.Run_point_Venue,
A.Run_point_Address,
B.Run_point_Venue,
B.Run_point_Address
FROM tbl_Points as A INNER JOIN tbl_Points as B
ON A.Run_No + 1 = B.Run_No
AND A.OrderSeq - 9 = B.OrderSeq

WHICH gives me this:

A.Point_ID A.Run_point_Venue A.Run_point_Address A.OrderSeq A.Run_No B.Run_No B.Point_ID B.OrderSeq B.Run_point_Venue B.Run_point_Address
11 De Vere Hotel 1 Aldwych 10 1 2 19 1 Hilton Hotel Tower Bridge Savoy Court
10 London Shelton Hotel Chancel Street 11 1 2 20 2 Bruebaker Hotel 10 John
Adam Street
12 Costello Palace Hotel Lavington Street 12 1 2 21 3 Parkside Hotel
N4 Cheney Road


BUT what I need is for the B.Run_Point_Venue and B.Run_point_Address to
merge with the A.Run_Point_Venue and A.Run_point_Address respectively, with
the B.Run_Point_Venue going before the A.Run_Point_Venue.

So that I end up with the fields and records like this:

Run_No Point_ID OrderSeq Run_point_Venue Run_point_Address
2 19 1 Hilton Hotel Tower Bridge Savoy Court
2 20 2 Bruebaker Hotel 10 John Adam Street
2 21 3 Parkside Hotel N4 Cheney Road
2 11 10 De Vere Hotel 1 Aldwych
2 10 11 London Shelton Hotel Chancel Street
2 12 12 Costello Palace Hotel Lavington Street





John Spencer said:
To get the last nine to match one for one to the first nine of the next
group, you would need something like the following.

SELECT A.Run_No, B.Run_No
, A.Point_ID, B.Point_ID
, A.OrderSeq, B.OrderSeq
FROM RunTable as A INNER JOIN RunTable as B
ON A.Run_No + 1 = B.Run_No
AND A.OrderSeq - 9 = B.OrderSeq

By the way, Point_ID cannot be the primary key since by definition no
two records can have the same value for the primary key field.

If I understood correctly, that should return
1,2,377,378,10,1
1,2,377,378,11,2
1,2,377,378,12,3
....


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

John, (after some sage advice from John W. Vinson, I have changed the table
somewhat and was wondering...

Can you help with this?...

I want to find a similar solution thing to the previous problem, but the key
difference here is that the 18 sets of fields are not seperated into 18
seperate fields, but have been normalized/consolidated into 1 field for Venue
and 1 for Address, but each set is held 'in order' by a [OrderSeq] field that
has a maximum of 18 per set of addresses.


The similar solution being I want to take the last 9 records (of each
OrderSeq) and marry them up with the first 9 records of the next set of 18.

For example:

Run_No 1 (last 9)
Run_No 2 (first 9)
and so on...


My table: (tbl_Points) looks like this:


Run_No (Master Field)
Point_ID (Primary Key)
OrderSeq (Number) orders the address list sequence)
Run_point_Venue (Text
Run_point_Address (Text)


From a user's point of view, the records are broken down into sets of 18,
denoted by a master field, Run_No. They are essentially ordered by the
[OrderSeq] field.


Sample records go like this:

Run_No Point_ID OrderSeq Run_point_Venue Run_point_Address
1
1 377 2 De Vere Hotel 1 Aldwych
1 377 3 London Shelton Hotel Chancel Street
1 377 4 Costello Palace Hotel Lavington Street
1 377 ...18 Hilton Hotel Tower Bridge Savoy Court

2 378 1 Bruebaker Hotel 10 John Adam Street
2 378 2 Parkside Hotel N4 Cheney Road
2 378 3 Elena Hotel Leicester Square
2 378 ...18 Hilton Tower Bridge Hotel Savoy Place

3 379 1 Celstion Hotel 18 Northumberland Avenue
3 379 2 Pembury Hotel Drury Lane
3 379 3 Eric Hotel Lennox Road
3 379 ...18 Holiday Inn Express SE1 Seven Sisters Road



:

No, I won't get notified if you post additional messages to this thread. I
usually keep an eye out, but I have been known to miss a followup.

Which solution did you use? You are always going to be missing half of the
fields in either the first record or the last record.

If you would rather the last record is unmatched then you need to modify the
two queries - whichever one you are using

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A INNER JOIN Run_Point as B
On A.Run_Point_List_ID = B.Run_Point_List_ID - 1 <<<<<<< minus 1 instead
of plus 1

Max and Less than instead of Min and greater than in the subquery.

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A , Run_Point as B
WHERE B.Run_Point_List_ID =
(SELECT Max(Tmp.Run_Point_List_ID)
FROM Run_Point as Tmp
WHERE Tmp.Run_Point_List_ID < A.Run_Point_List_ID)

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

John,

That is great, but not quite working the way I figured.

The 2nd half of the 1st segment is missing, as in an 'odd man out' kind of
way, where the very first record's 2nd half is (naturally) displaced by
the
next records' 1st half. I'm just trying to take in all the permutations,
as
there are even more fields that I have added, and i'm trying to get my
head
round a screen full of data rows now.

I didn't show the additonal fields in my first post as I didn't want to
make
extra work for someone such as yourself. They follow the same pattern as
the
original fields, just that they go from A-H (first half) I-P (2nd half) of
each record. in all a total of 16 fields laid out spreadsheet style. So,
once
I really get my head around what's what, can I come back to you on this?
(will you get email notification from my response?)


:

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A INNER JOIN Run_Point as B
On A.Run_Point_List_ID = B.Run_Point_List_ID +1

That will work as long as Run_Point_List_ID is sequential with NO gaps.

If you have gaps then life gets more complex as you will have to
calculate
the next higher number. That Might look something like the following.

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A , Run_Point as B
WHERE B.Run_Point_List_ID =
(SELECT Min(Tmp.Run_Point_List_ID)
FROM Run_Point as Tmp
WHERE Tmp.Run_Point_List_ID > A.Run_Point_List_ID)


--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

I have a table:

Run_point_List_ID 1 (Autonumber)
Run_point_Venue_A
Run_point_Venue_B
Run_point_Venue_C
Run_point_Venue_D


How can I get the query to return the first two fields from the 1st
record
and the second two fields from the 2nd record, and so on... like the
example
below?


From Record 1 From Record 1 From Record 2 From Record 2
From Record 2 From Record 2 From Record 3 From Record 3
From Record 3 From Record 3 From Record 4 From Record 4
From Record 4 From Record 4 From Record 5 From Record 5
From Record 5 From Record 5 From Record 6 From Record 6



Run_point_List_ID
1 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C
Run_point_Venue_D
Run_point_List_ID
2 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C
Run_point_Venue_D
Run_point_List_ID
3 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C
Run_point_Venue_D
Run_point_List_ID
4 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C
Run_point_Venue_D
 
E

efandango

John,

After perhaps I should explain fuller than my last reply.

The sort orders are perfect. The various fields and records tally up exacly
as I hoped they would. The only problem is that I have two sets of columns
for each set of records, like this:

A.Run_point_Venue A.Run_point_Address B.Run_point_Venue
B.Run_point_Address

Instead I was hoping for the two sets of 2 to be merged into one set of 2
columns. (All other id type fields included of course).

So that I get this kind of result: (just for example)

Run_No Point_ID OrderSeq Run_point_Venue Run_point_Address
1 19 1 Hilton Hotel Tower Bridge Savoy Court
1 20 2 Bruebaker Hotel 10 John Adam Street
1 21 3 Parkside Hotel N4 Cheney Road
2 99 1 Hilton Hotel Tower Bridge Savoy Court
2 34 2 Bruebaker Hotel 10 John Adam Street
2 78 3 Parkside Hotel N4 Cheney Road
2 12 4 De Vere Hotel 1 Aldwych
2 33 5 London Shelton Hotel Chancel Street
2 44 6 Costello Palace Hotel Lavington Street

In a single summary sentence, I just want to now merge the results of the 4
significant fields (Venue, Address) into 2 significant fields



efandango said:
John,

What I am trying to arrive at is just one overall consolidated set of:

Run_point_Venue Run_point_Address

instead I have two sets like this:

A.Run_point_Venue A.Run_point_Address B.Run_point_Venue
B.Run_point_Address



John Spencer said:
I really don't understand the results you want. It seems like you are
saying that you want a sort order of the records so that they appear in
a certain order.

I was pairing the records together in one result.

You will have to play around a bit with Point_ID and OrderSeq

The basic idea would be something like:

SELECT Run_No, Point_Id, OrderSeq
, Run_Point_Venue
, Run_Point_Address
FROM tbl_Points
ORDER BY IIF(OrderSeq > 9, Run_No, Run_No-1), OrderSeq

I'm not sure that will give you what you want, but you should be able to
experiment a bit to get what you are attempting. It might be that you
need to add 1 instead of subtract 1 or that ...

Good luck

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

John,

That is so nearly there, well so far your SQL has succesfully put them all
into the correct order, but I could only see the various record, Id, etc
numbers on the query result, so I added the text fields like this:

SELECT A.Run_No, B.Run_No, A.Point_ID, B.Point_ID, A.OrderSeq, B.OrderSeq,
A.Run_point_Venue,
A.Run_point_Address,
B.Run_point_Venue,
B.Run_point_Address
FROM tbl_Points as A INNER JOIN tbl_Points as B
ON A.Run_No + 1 = B.Run_No
AND A.OrderSeq - 9 = B.OrderSeq

WHICH gives me this:

A.Point_ID A.Run_point_Venue A.Run_point_Address A.OrderSeq A.Run_No B.Run_No B.Point_ID B.OrderSeq B.Run_point_Venue B.Run_point_Address
11 De Vere Hotel 1 Aldwych 10 1 2 19 1 Hilton Hotel Tower Bridge Savoy Court
10 London Shelton Hotel Chancel Street 11 1 2 20 2 Bruebaker Hotel 10 John
Adam Street
12 Costello Palace Hotel Lavington Street 12 1 2 21 3 Parkside Hotel
N4 Cheney Road


BUT what I need is for the B.Run_Point_Venue and B.Run_point_Address to
merge with the A.Run_Point_Venue and A.Run_point_Address respectively, with
the B.Run_Point_Venue going before the A.Run_Point_Venue.

So that I end up with the fields and records like this:

Run_No Point_ID OrderSeq Run_point_Venue Run_point_Address
2 19 1 Hilton Hotel Tower Bridge Savoy Court
2 20 2 Bruebaker Hotel 10 John Adam Street
2 21 3 Parkside Hotel N4 Cheney Road
2 11 10 De Vere Hotel 1 Aldwych
2 10 11 London Shelton Hotel Chancel Street
2 12 12 Costello Palace Hotel Lavington Street





:

To get the last nine to match one for one to the first nine of the next
group, you would need something like the following.

SELECT A.Run_No, B.Run_No
, A.Point_ID, B.Point_ID
, A.OrderSeq, B.OrderSeq
FROM RunTable as A INNER JOIN RunTable as B
ON A.Run_No + 1 = B.Run_No
AND A.OrderSeq - 9 = B.OrderSeq

By the way, Point_ID cannot be the primary key since by definition no
two records can have the same value for the primary key field.

If I understood correctly, that should return
1,2,377,378,10,1
1,2,377,378,11,2
1,2,377,378,12,3
....


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================


efandango wrote:
John, (after some sage advice from John W. Vinson, I have changed the table
somewhat and was wondering...

Can you help with this?...

I want to find a similar solution thing to the previous problem, but the key
difference here is that the 18 sets of fields are not seperated into 18
seperate fields, but have been normalized/consolidated into 1 field for Venue
and 1 for Address, but each set is held 'in order' by a [OrderSeq] field that
has a maximum of 18 per set of addresses.


The similar solution being I want to take the last 9 records (of each
OrderSeq) and marry them up with the first 9 records of the next set of 18.

For example:

Run_No 1 (last 9)
Run_No 2 (first 9)
and so on...


My table: (tbl_Points) looks like this:


Run_No (Master Field)
Point_ID (Primary Key)
OrderSeq (Number) orders the address list sequence)
Run_point_Venue (Text
Run_point_Address (Text)


From a user's point of view, the records are broken down into sets of 18,
denoted by a master field, Run_No. They are essentially ordered by the
[OrderSeq] field.


Sample records go like this:

Run_No Point_ID OrderSeq Run_point_Venue Run_point_Address
1
1 377 2 De Vere Hotel 1 Aldwych
1 377 3 London Shelton Hotel Chancel Street
1 377 4 Costello Palace Hotel Lavington Street
1 377 ...18 Hilton Hotel Tower Bridge Savoy Court

2 378 1 Bruebaker Hotel 10 John Adam Street
2 378 2 Parkside Hotel N4 Cheney Road
2 378 3 Elena Hotel Leicester Square
2 378 ...18 Hilton Tower Bridge Hotel Savoy Place

3 379 1 Celstion Hotel 18 Northumberland Avenue
3 379 2 Pembury Hotel Drury Lane
3 379 3 Eric Hotel Lennox Road
3 379 ...18 Holiday Inn Express SE1 Seven Sisters Road



:

No, I won't get notified if you post additional messages to this thread. I
usually keep an eye out, but I have been known to miss a followup.

Which solution did you use? You are always going to be missing half of the
fields in either the first record or the last record.

If you would rather the last record is unmatched then you need to modify the
two queries - whichever one you are using

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A INNER JOIN Run_Point as B
On A.Run_Point_List_ID = B.Run_Point_List_ID - 1 <<<<<<< minus 1 instead
of plus 1

Max and Less than instead of Min and greater than in the subquery.

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A , Run_Point as B
WHERE B.Run_Point_List_ID =
(SELECT Max(Tmp.Run_Point_List_ID)
FROM Run_Point as Tmp
WHERE Tmp.Run_Point_List_ID < A.Run_Point_List_ID)

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

John,

That is great, but not quite working the way I figured.

The 2nd half of the 1st segment is missing, as in an 'odd man out' kind of
way, where the very first record's 2nd half is (naturally) displaced by
the
next records' 1st half. I'm just trying to take in all the permutations,
as
there are even more fields that I have added, and i'm trying to get my
head
round a screen full of data rows now.

I didn't show the additonal fields in my first post as I didn't want to
make
extra work for someone such as yourself. They follow the same pattern as
the
original fields, just that they go from A-H (first half) I-P (2nd half) of
each record. in all a total of 16 fields laid out spreadsheet style. So,
once
I really get my head around what's what, can I come back to you on this?
(will you get email notification from my response?)


:

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A INNER JOIN Run_Point as B
On A.Run_Point_List_ID = B.Run_Point_List_ID +1

That will work as long as Run_Point_List_ID is sequential with NO gaps.

If you have gaps then life gets more complex as you will have to
calculate
the next higher number. That Might look something like the following.

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A , Run_Point as B
WHERE B.Run_Point_List_ID =
(SELECT Min(Tmp.Run_Point_List_ID)
FROM Run_Point as Tmp
WHERE Tmp.Run_Point_List_ID > A.Run_Point_List_ID)


--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

I have a table:

Run_point_List_ID 1 (Autonumber)
Run_point_Venue_A
Run_point_Venue_B
Run_point_Venue_C
Run_point_Venue_D


How can I get the query to return the first two fields from the 1st
record
and the second two fields from the 2nd record, and so on... like the
example
below?


From Record 1 From Record 1 From Record 2 From Record 2
From Record 2 From Record 2 From Record 3 From Record 3
From Record 3 From Record 3 From Record 4 From Record 4
 
E

efandango

John,

What I am trying to arrive at is just one overall consolidated set of:

Run_point_Venue Run_point_Address

instead I have two sets like this:

A.Run_point_Venue A.Run_point_Address B.Run_point_Venue
B.Run_point_Address



John Spencer said:
I really don't understand the results you want. It seems like you are
saying that you want a sort order of the records so that they appear in
a certain order.

I was pairing the records together in one result.

You will have to play around a bit with Point_ID and OrderSeq

The basic idea would be something like:

SELECT Run_No, Point_Id, OrderSeq
, Run_Point_Venue
, Run_Point_Address
FROM tbl_Points
ORDER BY IIF(OrderSeq > 9, Run_No, Run_No-1), OrderSeq

I'm not sure that will give you what you want, but you should be able to
experiment a bit to get what you are attempting. It might be that you
need to add 1 instead of subtract 1 or that ...

Good luck

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

John,

That is so nearly there, well so far your SQL has succesfully put them all
into the correct order, but I could only see the various record, Id, etc
numbers on the query result, so I added the text fields like this:

SELECT A.Run_No, B.Run_No, A.Point_ID, B.Point_ID, A.OrderSeq, B.OrderSeq,
A.Run_point_Venue,
A.Run_point_Address,
B.Run_point_Venue,
B.Run_point_Address
FROM tbl_Points as A INNER JOIN tbl_Points as B
ON A.Run_No + 1 = B.Run_No
AND A.OrderSeq - 9 = B.OrderSeq

WHICH gives me this:

A.Point_ID A.Run_point_Venue A.Run_point_Address A.OrderSeq A.Run_No B.Run_No B.Point_ID B.OrderSeq B.Run_point_Venue B.Run_point_Address
11 De Vere Hotel 1 Aldwych 10 1 2 19 1 Hilton Hotel Tower Bridge Savoy Court
10 London Shelton Hotel Chancel Street 11 1 2 20 2 Bruebaker Hotel 10 John
Adam Street
12 Costello Palace Hotel Lavington Street 12 1 2 21 3 Parkside Hotel
N4 Cheney Road


BUT what I need is for the B.Run_Point_Venue and B.Run_point_Address to
merge with the A.Run_Point_Venue and A.Run_point_Address respectively, with
the B.Run_Point_Venue going before the A.Run_Point_Venue.

So that I end up with the fields and records like this:

Run_No Point_ID OrderSeq Run_point_Venue Run_point_Address
2 19 1 Hilton Hotel Tower Bridge Savoy Court
2 20 2 Bruebaker Hotel 10 John Adam Street
2 21 3 Parkside Hotel N4 Cheney Road
2 11 10 De Vere Hotel 1 Aldwych
2 10 11 London Shelton Hotel Chancel Street
2 12 12 Costello Palace Hotel Lavington Street





John Spencer said:
To get the last nine to match one for one to the first nine of the next
group, you would need something like the following.

SELECT A.Run_No, B.Run_No
, A.Point_ID, B.Point_ID
, A.OrderSeq, B.OrderSeq
FROM RunTable as A INNER JOIN RunTable as B
ON A.Run_No + 1 = B.Run_No
AND A.OrderSeq - 9 = B.OrderSeq

By the way, Point_ID cannot be the primary key since by definition no
two records can have the same value for the primary key field.

If I understood correctly, that should return
1,2,377,378,10,1
1,2,377,378,11,2
1,2,377,378,12,3
....


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================


efandango wrote:
John, (after some sage advice from John W. Vinson, I have changed the table
somewhat and was wondering...

Can you help with this?...

I want to find a similar solution thing to the previous problem, but the key
difference here is that the 18 sets of fields are not seperated into 18
seperate fields, but have been normalized/consolidated into 1 field for Venue
and 1 for Address, but each set is held 'in order' by a [OrderSeq] field that
has a maximum of 18 per set of addresses.


The similar solution being I want to take the last 9 records (of each
OrderSeq) and marry them up with the first 9 records of the next set of 18.

For example:

Run_No 1 (last 9)
Run_No 2 (first 9)
and so on...


My table: (tbl_Points) looks like this:


Run_No (Master Field)
Point_ID (Primary Key)
OrderSeq (Number) orders the address list sequence)
Run_point_Venue (Text
Run_point_Address (Text)


From a user's point of view, the records are broken down into sets of 18,
denoted by a master field, Run_No. They are essentially ordered by the
[OrderSeq] field.


Sample records go like this:

Run_No Point_ID OrderSeq Run_point_Venue Run_point_Address
1
1 377 2 De Vere Hotel 1 Aldwych
1 377 3 London Shelton Hotel Chancel Street
1 377 4 Costello Palace Hotel Lavington Street
1 377 ...18 Hilton Hotel Tower Bridge Savoy Court

2 378 1 Bruebaker Hotel 10 John Adam Street
2 378 2 Parkside Hotel N4 Cheney Road
2 378 3 Elena Hotel Leicester Square
2 378 ...18 Hilton Tower Bridge Hotel Savoy Place

3 379 1 Celstion Hotel 18 Northumberland Avenue
3 379 2 Pembury Hotel Drury Lane
3 379 3 Eric Hotel Lennox Road
3 379 ...18 Holiday Inn Express SE1 Seven Sisters Road



:

No, I won't get notified if you post additional messages to this thread. I
usually keep an eye out, but I have been known to miss a followup.

Which solution did you use? You are always going to be missing half of the
fields in either the first record or the last record.

If you would rather the last record is unmatched then you need to modify the
two queries - whichever one you are using

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A INNER JOIN Run_Point as B
On A.Run_Point_List_ID = B.Run_Point_List_ID - 1 <<<<<<< minus 1 instead
of plus 1

Max and Less than instead of Min and greater than in the subquery.

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A , Run_Point as B
WHERE B.Run_Point_List_ID =
(SELECT Max(Tmp.Run_Point_List_ID)
FROM Run_Point as Tmp
WHERE Tmp.Run_Point_List_ID < A.Run_Point_List_ID)

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

John,

That is great, but not quite working the way I figured.

The 2nd half of the 1st segment is missing, as in an 'odd man out' kind of
way, where the very first record's 2nd half is (naturally) displaced by
the
next records' 1st half. I'm just trying to take in all the permutations,
as
there are even more fields that I have added, and i'm trying to get my
head
round a screen full of data rows now.

I didn't show the additonal fields in my first post as I didn't want to
make
extra work for someone such as yourself. They follow the same pattern as
the
original fields, just that they go from A-H (first half) I-P (2nd half) of
each record. in all a total of 16 fields laid out spreadsheet style. So,
once
I really get my head around what's what, can I come back to you on this?
(will you get email notification from my response?)


:

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A INNER JOIN Run_Point as B
On A.Run_Point_List_ID = B.Run_Point_List_ID +1

That will work as long as Run_Point_List_ID is sequential with NO gaps.

If you have gaps then life gets more complex as you will have to
calculate
the next higher number. That Might look something like the following.

SELECT A.Run_Point_List_ID
, A.Run_Point_Venue_A
, A.Run_Point_Venue_B
, B.Run_Point_Venue_C
, B.Run_Point_Venue_D
FROM Run_Point as A , Run_Point as B
WHERE B.Run_Point_List_ID =
(SELECT Min(Tmp.Run_Point_List_ID)
FROM Run_Point as Tmp
WHERE Tmp.Run_Point_List_ID > A.Run_Point_List_ID)


--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

I have a table:

Run_point_List_ID 1 (Autonumber)
Run_point_Venue_A
Run_point_Venue_B
Run_point_Venue_C
Run_point_Venue_D


How can I get the query to return the first two fields from the 1st
record
and the second two fields from the 2nd record, and so on... like the
example
below?


From Record 1 From Record 1 From Record 2 From Record 2
From Record 2 From Record 2 From Record 3 From Record 3
From Record 3 From Record 3 From Record 4 From Record 4
From Record 4 From Record 4 From Record 5 From Record 5
From Record 5 From Record 5 From Record 6 From Record 6



Run_point_List_ID
1 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C
Run_point_Venue_D
Run_point_List_ID
2 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C
Run_point_Venue_D
Run_point_List_ID
3 Run_point_Venue_A Run_point_Venue_B Run_point_Venue_C
Run_point_Venue_D
Run_point_List_ID
 
J

John Spencer

I guess I am being dense, but did you try the suggested query in my last
post. I thought that would give you what I think you are asking for.

At this point, I am not able to make any further suggestion.


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
E

efandango

John,

I did try your last suggestion, but negleted to mention that bit. instead
tryintg to answer the your question.

"It seems like you are saying that you want a sort order of the records so
that they appear in a certain order"

To which i replied that, yes they are now in the correct order; but your 2nd
comment "I was pairing the records together in one result" was not
manifesting when I run the query. instead I was getting 2x2 output columns. A
& B. I was just asking if their is a way of having the whole thing
consolidate into 2 columns, either A or B.

Your last/current suggestion gave me the pair of columns I was looking for,
but effectively changed nothing; in other words it lists the records in
exactly the order that the input table has them; eg: Run_No, Primary Key
Order as If I have just run a standard select query.

Now that I have two seperate pairs of records (but in the correct sequence
order), is there some SQL command that will merge or join them together?
 

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

Top