jadams0173
Technical User
- Feb 18, 2005
- 1,210
I need to get the most recent records from tblActions using tblHeader.MO as criteria without returning duplicates for the same PROBLEM in tblactions.
The table structures are:
tblHeader tblActions
ID (PK) (autonumber) HeaderID(FK)
MO ID(PK) (autonumber)
to make a 1 to many relationship.
example as of now:
MO Problem Owner InputDate CloseBy DateClosed
1234 test me 2/21/2007 2/22/2007 01/01/1900
1234 test1 you 2/21/2007 2/25/2007 01/01/1900
1234 new me 2/21/2007 2/22/2007 01/01/1900
1234 new1 us 2/21/2007 2/26/2007 01/01/1900
What I would like is:
MO Problem Owner InputDate CloseBy DateClosed
1234 test1 you 2/21/2007 2/25/2007 01/01/1900
1234 new1 us 2/21/2007 2/26/2007 01/01/1900
I tried to have patience but it took to long!
-DW
Code:
SELECT tblHeader.MO, tblActions.PROBLEM, tblActions.OWNER, tblActions.AREA, tblActions.PRIORITY, tblActions.INPUTDATE, tblActions.DATECLOSED, tblActions.ONREPORT, tblActions.EnteredBy, tblActions.ActionComment, tblActions.CLOSEBY
FROM tblHeader INNER JOIN tblActions ON tblHeader.HeaderID = tblActions.HEADERID
GROUP BY tblHeader.MO, tblActions.PROBLEM, tblActions.OWNER, tblActions.AREA, tblActions.PRIORITY, tblActions.INPUTDATE, tblActions.DATECLOSED, tblActions.ONREPORT, tblActions.EnteredBy, tblActions.ActionComment, tblActions.CLOSEBY
HAVING (((tblHeader.MO)="123456"));
The table structures are:
tblHeader tblActions
ID (PK) (autonumber) HeaderID(FK)
MO ID(PK) (autonumber)
to make a 1 to many relationship.
example as of now:
MO Problem Owner InputDate CloseBy DateClosed
1234 test me 2/21/2007 2/22/2007 01/01/1900
1234 test1 you 2/21/2007 2/25/2007 01/01/1900
1234 new me 2/21/2007 2/22/2007 01/01/1900
1234 new1 us 2/21/2007 2/26/2007 01/01/1900
What I would like is:
MO Problem Owner InputDate CloseBy DateClosed
1234 test1 you 2/21/2007 2/25/2007 01/01/1900
1234 new1 us 2/21/2007 2/26/2007 01/01/1900
I tried to have patience but it took to long!