MySQL Forums
Forum List  »  Newbie

Re: How to Limit Joined Table's Rows?
Posted by: Peter Brawley
Date: July 29, 2019 08:37PM

The manual page for Group_Concat() doesn't show Limit as a Group_Concat() option. We can't just make up syntax. What you can do is limit a result with Order By ... Limit ..., then process that result with Group_Concat(), eg given tables a(id) and b(id,t) ...

select a.id, group_concat(x.t)
from a
join (
  select id, t
  from b 
  order by t desc limit 10
) x using(id)
group by a.id;

Options: ReplyQuote


Subject
Written By
Posted
Re: How to Limit Joined Table's Rows?
July 29, 2019 08:37PM


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.