is there a group_concat function in ms-access?(ms-access 中有 group_concat 函数吗?)
问题描述
ms-access 中是否有 group_concat 函数或类似的东西?
is there a group_concat function in ms-access or something similar?
推荐答案
你应该问问自己是否需要一个通用的解决方案 (另一个是 Allen Browne 的),或者如果您仅出于当前目的需要它.如果您真的只需要它一次,请使用简单的方法.
You should ask yourself if you need a generic solution (another is by Allen Browne) or if you need it just for the present purpose. If you really only need it this once, do it the easy way.
附带说明,在 VBA 代码中连接列表时,利用长期访问专家 Trevor Best 教给我的技巧,那就是在每个值的开头粘贴分隔符,然后使用 Mid()把它剥掉.而不是在你的循环中通过子记录:
On a side note, when concatenating lists in VBA code, take advantage of a trick taught to me by long-time Access guru Trevor Best, and that's to stick the delimiter at the beginning of every value and then use Mid() to strip it off. Instead of this inside your loop through the child records:
If Len(strOutput) = 0 Then
strOutput = NewValue
Else
strOutput = strOutput & ", " & NewValue
End If
...在循环中使用它:
...use this inside the loop:
strOutput = strOutput & ", " & NewValue
...然后当你退出循环时,去掉前导分隔符:
...and then when you exit the loop, strip off the leading delimiter:
strOutput = Mid(strOutput, 3)
这对所有地方都有影响,并简化了在大量上下文中进行连接的代码.
This has implications all over the place and simplifies code for concatenation in a whole host of contexts.
这篇关于ms-access 中有 group_concat 函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:ms-access 中有 group_concat 函数吗?
基础教程推荐
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 无法解决整理冲突 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
