Skip to content

Instantly share code, notes, and snippets.

@olegwtf
Created May 25, 2012 09:28
Show Gist options
  • Save olegwtf/2786950 to your computer and use it in GitHub Desktop.
Save olegwtf/2786950 to your computer and use it in GitHub Desktop.
Select (group by)
select collection.uid, orgs.name,
group_concat(ifnull(attributes.name,"") separator "\0"),
group_concat(ifnull(collection.value,"") separator "\0"),
group_concat(ifnull(variants.value,"") separator "\0")
from collection
left join orgs on orgs.uid=collection.uid
left join variants on collection.variant=variants.id
left join attributes on collection.attr_id=attributes.id
where orgs.proj_id = ?
group by collection.uid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment