打印键和相应值列表

时间:2016-10-09 02:29:30

标签: scala

我需要输出String, Iterable[String]类型的答案,其中String等于键3,而Iterable[String]values的列表,对应于3 Array[(String, String)] = Array((2,1), (2,1), (2,3), (2,3), (2,1), (2,4), (3,2), (2,2), (2,4), (3,2), (2,4), (2,3), (3,2), (3,2), (2,5), (2,5), (2,7), (2,1), (2,6), (3,3), (2,5), (3,2), (15,2), (3,2))

鉴于以下内容:

3, [2,2,2,2,3,2,2]

答案应该是:

SELECT  *
        ,ROW_NUMBER()OVER(PARTITION BY Name_of_User, ActivityCode ORDER BY ActivityID)-1 AS ConsecActivityCount 
FROM    ActivityTable

有人知道我该怎么办吗?

谢谢。

1 个答案:

答案 0 :(得分:0)

您可以通过过滤键和映射来完成此操作:

key_buffer = 384M
max_allowed_packet = 64M
table_open_cache = 4096
sort_buffer_size = 2M

#InnoDB specifications
innodb_buffer_pool_size = 384M
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 10M
innodb_log_buffer_size = 64M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 180