Skip to content

Instantly share code, notes, and snippets.

@zhaoxiaobao
Created January 25, 2018 09:40
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 zhaoxiaobao/2a01ceb6f48661a3017e1b37f54a0419 to your computer and use it in GitHub Desktop.
Save zhaoxiaobao/2a01ceb6f48661a3017e1b37f54a0419 to your computer and use it in GitHub Desktop.
sql 几条sql查询出此结果
表1 group表
id group_name
1 g1
2 g2
表2 list表
id name group_id
1 n1 1
2 n2 1
3 n3 2
查询结果
[{
group_name:g1,
group_list:[{
id:1,
name:n1
},{
id:2,
name:n2
}]
},{
group_name:g2,
group_list:[{
id:3,
name:n3
}]
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment