L
Llyllyll
Afternoon all,
Please could someone help. I have two queries (as set out below) and would
like to use these to create one dynamic SQL statement. I've been browsing
the group for a while but can't seem to get me head around the syntax. I'm
using Access 97 and the results of this query will be passed to a report in
Excel. What I'm trying to achieve is to get the minimum and maximum
consecutive number that's been assigned to each company.
Query1
SELECT tblConsec.RecordID, tblConsec.ConsecNo, tblConsec.Company,
tblConsec.Years, tblConsec.ReportP380
FROM tblConsec
WHERE (((tblConsec.ReportP380)=False))
ORDER BY tblConsec.RecordID;
Query2
SELECT Query1.Company, Min(Query1.ConsecNo) AS MinOfConsecNo,
Max(Query1.ConsecNo) AS MaxOfConsecNo
FROM Query1
GROUP BY Query1.Company
ORDER BY Min(Query1.ConsecNo);
Grateful for all help and advice.
Thanks
Please could someone help. I have two queries (as set out below) and would
like to use these to create one dynamic SQL statement. I've been browsing
the group for a while but can't seem to get me head around the syntax. I'm
using Access 97 and the results of this query will be passed to a report in
Excel. What I'm trying to achieve is to get the minimum and maximum
consecutive number that's been assigned to each company.
Query1
SELECT tblConsec.RecordID, tblConsec.ConsecNo, tblConsec.Company,
tblConsec.Years, tblConsec.ReportP380
FROM tblConsec
WHERE (((tblConsec.ReportP380)=False))
ORDER BY tblConsec.RecordID;
Query2
SELECT Query1.Company, Min(Query1.ConsecNo) AS MinOfConsecNo,
Max(Query1.ConsecNo) AS MaxOfConsecNo
FROM Query1
GROUP BY Query1.Company
ORDER BY Min(Query1.ConsecNo);
Grateful for all help and advice.
Thanks