Skip to content

Instantly share code, notes, and snippets.

@LeandroLS
Created June 21, 2017 15:20
Show Gist options
  • Save LeandroLS/b906cc03e04df309ce9bc252a540e460 to your computer and use it in GitHub Desktop.
Save LeandroLS/b906cc03e04df309ce9bc252a540e460 to your computer and use it in GitHub Desktop.
Gist post indices-mysql
SELECT
*,
(SELECT
COUNT(l2.data_de_lancamento)
FROM
livros AS l2
WHERE
l2.data_de_lancamento = l.data_de_lancamento) AS vendas_anteriores
FROM
livros AS l;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment