【发布时间】:2023-02-08 09:59:08
【问题描述】:
我有如下输入表-
| id | col1 | col2 | time |
|---|---|---|---|
| 01 | abc | 001 | 12:00 |
| 01 | def | 002 | 12:10 |
所需的输出表-
| id | col1 | col2 | time | diff_field |
|---|---|---|---|---|
| 01 | abc | 001 | 12:00 | null |
| 01 | def | 002 | 12:10 | col1,col2 |
我需要比较两行并找到所有值不同的列,并将这些列名保留在新列中差异字段.
我需要一个优化的解决方案,因为我的表有超过 100 列(所有列都需要比较)
【问题讨论】:
-
使说明更清楚?您是否正在比较行与行并记录哪些列在后一行中具有不同的值?如果是这样,为什么您的输出表 diff_field 列第二行没有“时间”,因为时间列中的值在 row1 和 row2 中不同?
标签: google-cloud-platform google-bigquery bigdata