MySQL Forums
Forum List  »  Newbie

Re: Making query ONLY_FULL_GROUP_BY compatible
Posted by: Peter Brawley
Date: July 15, 2016 09:47AM

If `name` has dupes, there are matching description dupes too. How do you wish to handle that?

If there are no name dupes ...

select x.id_category, c.name, c.description
from category_table c
join (
  select id_category, max(name) as maxname 
  from category_table 
  where id_lang=1 
  group by id_category 
) x on c.name=x.maxname
order by c.name;  

Options: ReplyQuote




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.