I am having a problem with record sorting. The data being pulled is for primary and secondary company locations. I have 2 queries that pull the data seperatly, but need a way of combining the output. The first query will give me all of the Primary locations.
The second query does the same for the secondary locations.
The final result that I am trying to acheve is for the primaries to print out in company order with their secondaries. Something like this.
Company 1 Primary
secondary 1 of Company 1
secondary 2 of Company 1
Company 2 Primary
Secondary 1 of Company 2
Company 3 Primary
Company 4 Primary
Not all Primaries have secondaries, as with Company 3 above.
The fields that tie the secondary companies to the primaries are the T01CLINOP and T01CLILOP of the secondaries equals the T01CLINO and T01CLILO of the Primary.
I think this can be done by using the exsisting queries as the source for a new query. All help is appreciated.
Thanks in advance.
Alan
Senility at its finest
Code:
SELECT DISTINCT QAMAIN.T01PLSL, QAMAIN.COMPANY, QAMAIN.T01CLINO, QAMAIN.T01CLILO, States.[AOFA ST], [Date on Report].[Date on Report], QAMAIN.T01CONDTM, QAMAIN.REGION, QAMAIN.T01CLINOP, QAMAIN.T01CLILOP
FROM [Date on Report], QAMAIN INNER JOIN States ON QAMAIN.STATE = States.ST
WHERE (((QAMAIN.T01PLSL)="P") AND ((QAMAIN.T01CONDTM)=[Enter Month for Covers]))
ORDER BY QAMAIN.COMPANY
WITH OWNERACCESS OPTION;
Code:
SELECT DISTINCT QAMAIN.T01PLSL, QAMAIN.COMPANY, QAMAIN.T01CLINO, QAMAIN.T01CLILO, States.[AOFA ST], [Date on Report].[Date on Report], QAMAIN.T01CONDTM, QAMAIN.REGION, QAMAIN.T01CLINOP, QAMAIN.T01CLILOP
FROM [Date on Report], QAMAIN INNER JOIN States ON QAMAIN.STATE = States.ST
WHERE (((QAMAIN.T01PLSL)="S") AND ((QAMAIN.T01CONDTM)=[Enter Month for Covers]))
ORDER BY QAMAIN.COMPANY
WITH OWNERACCESS OPTION;
Company 1 Primary
secondary 1 of Company 1
secondary 2 of Company 1
Company 2 Primary
Secondary 1 of Company 2
Company 3 Primary
Company 4 Primary
Not all Primaries have secondaries, as with Company 3 above.
The fields that tie the secondary companies to the primaries are the T01CLINOP and T01CLILOP of the secondaries equals the T01CLINO and T01CLILO of the Primary.
I think this can be done by using the exsisting queries as the source for a new query. All help is appreciated.
Thanks in advance.
Alan
Senility at its finest