在jooq groupConcatDistinct方法上指定分隔符

时间:2018-10-18 12:08:02

标签: java sql jooq

是否可以为JOOQ中的方法groupConcatDistinct指定自定义分隔符?方法groupConcat有第二个参数,但是这个参数多次返回相同的值,这是我不希望的。

谢谢!

2 个答案:

答案 0 :(得分:1)

好吧,我找到了答案,用groupConcatDistinct分隔符是链接的而不是参数。像这样groupConcatDistinct(...).separator(", ")

答案 1 :(得分:0)

这只是API设计中的一个疏漏。我在这里创建了功能请求: https://github.com/jOOQ/jOOQ/issues/7956

与使用jOOQ时一样,当您遇到缺少的功能时,可以使用plain SQL templating。例如

+----+-------------+-------+------------+------+------------------------------------------------------------------------------------------------------------+-----------------------------+---------+-------+---------+----------+---------------------------------------------------------------------+
| id | select_type | table | partitions | type | possible_keys                                                                                              | key                         | key_len | ref   | rows    | filtered | Extra                                                               |
+----+-------------+-------+------------+------+------------------------------------------------------------------------------------------------------------+-----------------------------+---------+-------+---------+----------+---------------------------------------------------------------------+
|  1 | SIMPLE      | evt   | NULL       | ref  | Event_userId_index,Event_subType_storeId_index,Event_timetamp_index,Event_timestamp_subtype_userId_storeId | Event_subType_storeId_index | 3       | const | 7375964 |    25.00 | Using index condition; Using where; Using temporary; Using filesort |
+----+-------------+-------+------------+------+------------------------------------------------------------------------------------------------------------+-----------------------------+---------+-------+---------+----------+---------------------------------------------------------------------+