MySQL Forums
Forum List  »  Newbie

Unable to get Last Record..
Posted by: Julianna Fruin
Date: May 25, 2017 10:03AM

I am trying to get the last record with the latest timestamp on dd_acquired_ts so that I can plug that value in to UPDTAE statement, but max (d.dd_acquired_ts), top 1 (d.dd_acquired_ts) returns an error. Please advise me on how to get the last / max record off of:

SELECT max (d.dd_acquired_ts)
FROM tdds.discrete_data d
where d.dd_acquired_ts < 1493152486000
ORDER BY d.dd_acquired_ts asc
LIMIT 100000


// 'innodb_version', '1.1.8'

update tdds.discrete_data d
set d.dd_auto_purge=1
where d.dd_acquired_ts < (SELECT max (d.dd_acquired_ts)
FROM tdds.discrete_data d
where d.dd_acquired_ts < 1493152486000
ORDER BY d.dd_acquired_ts asc
LIMIT 100000)

Options: ReplyQuote


Subject
Written By
Posted
Unable to get Last Record..
May 25, 2017 10:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.