MySQL Forums
Forum List  »  Newbie

Re: Duplicate lines but I cant seem to remove them,
Posted by: Peter Brawley
Date: February 19, 2014 07:27PM

Your query is missing logic to find what you call "the last transition status" of each bug. You can see several ways to solve such problems under "Within-group aggregates" at http://www.artfulsoftware.com/infotree/queries.php. Some of them perform well, some not. A simple solution is #5 in that list, a "trick" made possible by MySQL's wayward GROUP BY rules:

SELECT * 
FROM ( 
  SELECT * 
  FROM buglist 
  ORDER BY date_modified DESC 
) AS s 
GROUP BY bug_id;

You ought to be able to add your CASE statements & joins to that simple scaffolding.

Options: ReplyQuote


Subject
Written By
Posted
Re: Duplicate lines but I cant seem to remove them,
February 19, 2014 07:27PM


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.