假设我有一个填充了以下数据的表,我应该在 db2 中使用什么 SQL 函数或查询来检索所有具有值为 A 的 FIRST 字段 FLD_A、值为 B 的 FIRST 字段 FLD_A 的所有行等等?
ID FLD_A FLD_B
1 A 10
2 A 20
3 A 30
4 B 10
5 A 20
6 C 30
我期待下面的表格;我知道按功能分组GROUP BY but how can I limit the query to return the very first of each group?
Essentially I would like to have the information about the very first row where a new value for FLD_A is appearing for the first time?
ID FLD_A FLD_B
1 A 10
4 B 10
6 C 30