gpt4 book ai didi

mysql - 关于 MySQL 分组依据

转载 作者:行者123 更新时间:2023-11-29 04:52:23 25 4
gpt4 key购买 nike

我有

TableName
==============================
ID | A_ID | BLABLA | TIME
-----------------------------------------------
1 | n1 | X | Time
2 | n1 | X | Time
3 | n1 | X | Time
4 | n1 | Y | Time
5 | n1 | Z | Time
6 | n2 | Y | Time
7 | n2 | Y | Time
8 | n2 | Y | Time
9 | n3 | X | Time
10 | n4 | Z | Time
11 | n4 | Z | Time
13 | n5 | | Time
14 | n6 | X | Time
15 | n7 | | Time
16 | n8 | | Time
==================================

我想查询显示表结果并仅使用 MySQL 查询。

==============================
A_ID | BLABLA
-----------------------------------------------
n1 | X
n1 | Y
n1 | Z
n2 | Y
n3 | X
n4 | Z
n5 |
n6 | X
n7 |
n8 |
==================================

最佳答案

您只需要GROUP BY A_ID, BLABLA,就像这样:

SELECT A_ID, BLABLA 
FROM TableName
GROUP BY A_ID, BLABLA

关于mysql - 关于 MySQL 分组依据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10274861/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com