![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
SELECT * FROM ACTION_HISTORY WHERE CASE_ID = '534623' AND EVENTNAME='AssignedChanged' AND LASTUPDATE = ( SELECT MAX(LASTUPDATE) FROM ACTION_HISTORY WHERE CASE_ID = '534623' AND EVENTNAME='AssignedChanged') ORDER BY LASTUPDATE DESC; |
#3
| |||
| |||
|
|
I have a query that I have written and it works, but it seems a bit redundant and I am wondering if there is a better way to write it. My basic problem is I want to pull only 1 record, and that record is the newest one based on the LASTUPDATE date field. Here is my attempt at the query SELECT * FROM ACTION_HISTORY WHERE CASE_ID = '534623' AND EVENTNAME='AssignedChanged' AND LASTUPDATE = ( SELECT MAX(LASTUPDATE) FROM ACTION_HISTORY WHERE CASE_ID = '534623' AND EVENTNAME='AssignedChanged') ORDER BY LASTUPDATE DESC; If you have return restriction clauses like FETCH FIRST 1 ROW ONLY |
#4
| |||
| |||
|
|
My basic problem is I want to pull only 1 record [sic], and that record [sic] is the newest one based on the LASTUPDATE date field [sic]. |
#5
| |||
| |||
|
|
I have a query that I have written and it works, but it seems a bit redundant and I am wondering if there is a better way to write it. My basic problem is I want to pull only 1 record, and that record is the newest one based on the LASTUPDATE date field. Here is my attempt at the query SELECT * FROM ACTION_HISTORY WHERE CASE_ID = '534623' AND EVENTNAME='AssignedChanged' AND LASTUPDATE = ( SELECT MAX(LASTUPDATE) FROM ACTION_HISTORY WHERE CASE_ID = '534623' AND EVENTNAME='AssignedChanged') ORDER BY LASTUPDATE DESC; |
![]() |
| Thread Tools | |
| Display Modes | |
| |