我有一个数据透视表,其中包含许多调查回复摘要,格式如下。
+-----------+---------+--------+---------+----------+------------+-------+
| Response | Alabama | Alaska | Arizona | Arkansas | California | Etc.. |
+-----------+---------+--------+---------+----------+------------+-------+
| Cool | 7 | 8 | 10 | 8 | 87 | .. |
| Boring | 12 | 9 | 11 | 1 | 12 | .. |
| Hot | 1 | 61 | 17 | 9 | 53 | .. |
| Cold | 14 | 37 | 98 | 84 | 85 | .. |
| Expensive | 56 | 8 | 9 | 6 | 2 | .. |
| etc.. | .. | .. | .. | .. | .. | .. |
+-----------+---------+--------+---------+----------+------------+-------+
它向下延伸到超过1,000行,跨越50列(状态)。
以最快的方式结束每个州的字词排名最快的方法是什么?
注意: 根据上面的数据片段,这不是正确的排名。这是用于说明的虚拟数据。
+---------+-----------+---------+---------+-----------+------------+-------+
| Ranking | Alabama | Alaska | Arizona | Arkansas | California | Etc.. |
+---------+-----------+---------+---------+-----------+------------+-------+
| 1 | Hot | Cold | Hot | Trendy | Sunny | .. |
| 2 | Expensive | Empty | Dry | Backwards | Fun | .. |
| 3 | Big | Wet | Deadly | Good | Great | .. |
| 4 | Dry | Icy | Cool | Bad | Best | .. |
| 5 | Fun | Not Bad | Fuego | Ugly | Poor | .. |
| etc.. | .. | .. | .. | .. | .. | .. |
+---------+-----------+---------+---------+-----------+------------+-------+
看起来这可能很简单,不需要手动操作50次。很高兴在Google表格中使用SQL来实现这一目标!