I have a table 'dummy' like this
name, status , date, is-updated
n1, s1, 2013-09-01, false
n2, s2, 2013-09-01, false
n1, s11, 2013-09-02, false
Now in-order to get the most recent timestamps for a particular name, i am using the query:
select name, status, max(date)
from dummy
where is-updated=false
group by name,status
This is working fine as expected, returning two rows
n2, s2, 2013-09-01, false
n1, s11, 2013-09-02, false
Now how to update the 'is-updated' value as 'true' for the above two rows ?? 'IN' clause in sql doesn't support multiple columns.
update dummy
set is-updated = true
where name, status, date in (
select name, status, max(date)
from dummy
where is-updated=false
group by name,status
)
Can anyone help with this ? Thanks.