Skip to content

Instantly share code, notes, and snippets.

@fabiotatsuo
Created March 23, 2016 07:07
Show Gist options
  • Save fabiotatsuo/672174ac209ff5160cde to your computer and use it in GitHub Desktop.
Save fabiotatsuo/672174ac209ff5160cde to your computer and use it in GitHub Desktop.
Query one to many mysql
use databse;
SELECT
n.id as noticia_id,
n.titulo as post_title,
n.categoria_noticia_id as categoria_noticia_id,
c.nome as tag_name
FROM noticia as n
LEFT JOIN categoria_noticia as c ON c.id = n.categoria_noticia_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment