Skip to content

Instantly share code, notes, and snippets.

@tlkshadow
Created April 24, 2017 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlkshadow/bc1e7b3f128309380c1120f71a2397ea to your computer and use it in GitHub Desktop.
Save tlkshadow/bc1e7b3f128309380c1120f71a2397ea to your computer and use it in GitHub Desktop.
SELECT
a.id,
(SELECT name FROM brand WHERE id = a.brand_id) as name,
(SELECT group_concat(name) FROM supplier WHERE s.article_id = a.id) as supplier_names,
(SELECT max(price) FROM article_price WHERE article_id = a.id) as max_price
FROM article a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment