sql - BigQuery 调整表以消除具有两个相互依赖的行的重复项
问题描述
表格有两个维度,我想根据两个维度清除重复项,以便调整后只剩下一对。我相信它应该是基本的,因为我是新手,也许有人可以指出我正确的方向?
select id, label
from table1
unique_id label
1 fast
1 streaming
1 fast
2 issue
2 fast
2 other
3 other
3 other
3 other
我想收到这样的表:
unique_id label
1 fast
1 streaming
2 issue
2 fast
2 other
3 other
解决方案
您可以使用select distinct
:
select distinct id, label
from table1;
推荐阅读
- macos - 如何在 MacOS (Catalina 10.15.2) 上运行 PovRay?
- javascript - 使用listen()方法在node.js中设置端口
- javascript - 修改所有出站链接
- search - 使用 GAS 应用用户定义的过滤器(实现表搜索功能)
- postgresql - 创建从 postgres 超级用户到另一个拥有自己所有者的数据库的扩展?
- python - 运行游戏时出现空白窗口
- javascript - 使用 Typescript Angular 动态替换字符串
- python - 字节表示中的 \t 和 \r 是什么?
- python - 在 csv 行中写入多个值而不是下一行
- java - 这个最终的整数变量初始化有什么问题?