Group by only returns 1 result

Asked

Viewed 49 times

0

I have a problem with my query in Mysql:

SELECT 
    *
    FROM `campeonatos` 
    INNER JOIN `jogos`
    ON `campeonatos`.`camp_id`=`jogos`.`campeonato_id` 
    WHERE `jogos`.`inicio` > "2017-10-30 00:00:00" 
    ORDER BY `campeonatos`.`camp_nome` ASC

The problem it groups and only returns the first record. I would like him to group for the championship and return something more or less like this:

Campeonato : 888
São Paulo x Flamengo
São Paulo x Flamengo

Campeonato 889
São Paulo x Flamengo
São Paulo x Flamengo
  • You can post the group by tempted?

  • Lucas to group, you have to use the GROUP BY... But to help better, post the creation script and data: http:/sqlfiddle.com/

  • @Jeffersonquesado http://sqlfiddle.com/#! 9/33932e/1

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.