MySQL Forums
Forum List  »  Newbie

Re: MySQL get highest value and delete other rows
Posted by: Martin K
Date: July 07, 2018 03:36AM

Yeah, of course, I meant table not database.

An example row would be

(parent_id, comment_id, parent (this is the text of the parent), comment, subreddit, unix, score)

t3_2qyrla, t1_cnas8zv, NULL, Most of us have some family members like this. *Most of my family is like this., exmormon, 420070400, 14


And I was just thinking, what if I used your first query to set a variable (I'm not sure if this is possible with MySQL), and then, another query like:

DELETE FROM parent_reply WHERE @variable.score > score AND @variable.parent_id = parent_id;

Would something like that be possible?

Options: ReplyQuote


Subject
Written By
Posted
Re: MySQL get highest value and delete other rows
July 07, 2018 03:36AM


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.