G
Guest
I need some helpe with a grouped query I have. Here is the SQL:
SELECT Trim([unit_id]) AS NT_unit, qryNT.test AS NT_test, Last(qryNT.result)
AS LastOfresult, qyrNT.unit_type, Last(qryNT.run_date) AS LastOfrun_date,
qryNT.status AS NT_status INTO tblNT_Copy
FROM qryNT
GROUP BY Trim([unit_id]), qryNT.test, qryNT.unit_type, qryNT.status;
This query is based on a pass through query to FoxPro tables. I need all
of these fields in the local table and I want only one record for each unit
with the latest run_date. This issue is that "result" could have 2
different values. This query works except that it can mis-match the result
value to the wrong record.
Is there a better way to do this? I have tried other designs but the
resulting report runs very slow.
Thanks
LeAnn
SELECT Trim([unit_id]) AS NT_unit, qryNT.test AS NT_test, Last(qryNT.result)
AS LastOfresult, qyrNT.unit_type, Last(qryNT.run_date) AS LastOfrun_date,
qryNT.status AS NT_status INTO tblNT_Copy
FROM qryNT
GROUP BY Trim([unit_id]), qryNT.test, qryNT.unit_type, qryNT.status;
This query is based on a pass through query to FoxPro tables. I need all
of these fields in the local table and I want only one record for each unit
with the latest run_date. This issue is that "result" could have 2
different values. This query works except that it can mis-match the result
value to the wrong record.
Is there a better way to do this? I have tried other designs but the
resulting report runs very slow.
Thanks
LeAnn