Crystalguru
Technical User
Howdy,
Trying to get the Max row out of a table.
For example:
ClientUID OrderUID Ordermaintidcode toucheddtm reason
4556 123 101 02-19-05 01:00 New
4556 123 102 02-19-05 02:00 Changed
4556 123 103 02-19-05 02:30 Final
What I need returned is the last row of information.(#103)
Here is my query:
SELECT CLIENTUID
,ORDERUID
,MAX(ORDERMAINTIDCODE)
,MAX(TOUCHEDWHEN)
,MAX(REASONTEXT)
FROM ORDERSTATUSHISTORY
WHERE CLIENTUID = 5000017718020001
AND ORDERUID = 1000855293068001
GROUP BY CLIENTUID, ORDERUID
What I have been getting with the above query is:
ClientUID OrderUID Ordermaintidcode toucheddtm reason
4556 123 103 02-19-05 02:30 Changed
Notice the reason field is from the row #102.
Need someone else's eyes to help here.
Thanks in advance.
Trying to get the Max row out of a table.
For example:
ClientUID OrderUID Ordermaintidcode toucheddtm reason
4556 123 101 02-19-05 01:00 New
4556 123 102 02-19-05 02:00 Changed
4556 123 103 02-19-05 02:30 Final
What I need returned is the last row of information.(#103)
Here is my query:
SELECT CLIENTUID
,ORDERUID
,MAX(ORDERMAINTIDCODE)
,MAX(TOUCHEDWHEN)
,MAX(REASONTEXT)
FROM ORDERSTATUSHISTORY
WHERE CLIENTUID = 5000017718020001
AND ORDERUID = 1000855293068001
GROUP BY CLIENTUID, ORDERUID
What I have been getting with the above query is:
ClientUID OrderUID Ordermaintidcode toucheddtm reason
4556 123 103 02-19-05 02:30 Changed
Notice the reason field is from the row #102.
Need someone else's eyes to help here.
Thanks in advance.