Hi, I' ve been struggling for a few days with following problem.
I have a query with 2 tables (below). They are joined by one key field checknr.
I would only like to see field comm from table OTCUser.checkli stcomm, but only the last result which are conform to the condition. So the fields in black shouldn't appair.
Can someone help me ?
SELECT MAX(p.Modifdatu m) AS modifdatumv, OTCUser.checkli stcomm.comm, p.Status, p.station, p.checkitem
FROM OTCUser.checkli ststat p INNER JOIN
OTCUser.checkli stcomm ON p.Checknr = OTCUser.checkli stcomm.checknr
GROUP BY p.station, p.checkitem, OTCUser.checkli stcomm.comm, p.Status
HAVING (p.Status = '2') AND (p.station = '00BE104740')
ORDER BY p.station, p.checkitem
modifdatum comm status checknr station
10/04/2007 11:15:20 comment 0 2 00BE104740 14
10/05/2007 8:57:45 comment 1 2 00BE104740 14 10
/10/2007 11:59:35 comment 2 2 00BE104740 14
10/04/2007 11:15:20 comment 2 00BE104740 16
10/04/2007 11:15:20 comment 2 00BE104740 17
10/08/2007 17:20:43 comment 2 00BE104740 18
10/04/2007 11:15:20 comment 2 00BE104740 22
10/04/2007 11:15:20 comment 2 00BE104740 24
10/04/2007 11:15:20 comment 2 00BE104740 25
10/04/2007 11:15:20 comment 2 00BE104740 26
10/08/2007 17:20:43 comment 2 00BE104740 26
10/04/2007 11:15:20 comment 1 2 00BE104740 27
10/08/2007 17:20:43 comment 2 2 00BE104740 27
10/04/2007 11:15:20 comment 2 00BE104740 31
I have a query with 2 tables (below). They are joined by one key field checknr.
I would only like to see field comm from table OTCUser.checkli stcomm, but only the last result which are conform to the condition. So the fields in black shouldn't appair.
Can someone help me ?
SELECT MAX(p.Modifdatu m) AS modifdatumv, OTCUser.checkli stcomm.comm, p.Status, p.station, p.checkitem
FROM OTCUser.checkli ststat p INNER JOIN
OTCUser.checkli stcomm ON p.Checknr = OTCUser.checkli stcomm.checknr
GROUP BY p.station, p.checkitem, OTCUser.checkli stcomm.comm, p.Status
HAVING (p.Status = '2') AND (p.station = '00BE104740')
ORDER BY p.station, p.checkitem
modifdatum comm status checknr station
10/04/2007 11:15:20 comment 0 2 00BE104740 14
10/05/2007 8:57:45 comment 1 2 00BE104740 14 10
/10/2007 11:59:35 comment 2 2 00BE104740 14
10/04/2007 11:15:20 comment 2 00BE104740 16
10/04/2007 11:15:20 comment 2 00BE104740 17
10/08/2007 17:20:43 comment 2 00BE104740 18
10/04/2007 11:15:20 comment 2 00BE104740 22
10/04/2007 11:15:20 comment 2 00BE104740 24
10/04/2007 11:15:20 comment 2 00BE104740 25
10/04/2007 11:15:20 comment 2 00BE104740 26
10/08/2007 17:20:43 comment 2 00BE104740 26
10/04/2007 11:15:20 comment 1 2 00BE104740 27
10/08/2007 17:20:43 comment 2 2 00BE104740 27
10/04/2007 11:15:20 comment 2 00BE104740 31
Comment