嵌套分组依据
我有一个表,其中包含人员的年龄和他们所在的组,但有时该组不存在。
我想获得每个组的总年龄,但如果组数据丢失,那么我想要该人的姓名及其年龄。
它几乎就像一个嵌套组。我想首先按组名称进行分组,但如果不存在,则按个人姓名进行分组。
我希望这是有道理的!非常感谢任何帮助。
I have a table that contains ages of people and a group they are in, but sometimes the group is not present.
I would like to get a total age per group, but if the group data is missing then I would like the name of the person and their age.
It is almost like a nested group. I want to group by the group name first, but if it isn't present then group by individual's name.
I hope that makes some sense! Any help greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以尝试一下工会...
<代码>
You might try a union...