gpt4 book ai didi

sql - ms-access 中有 group_concat 函数吗?

转载 作者:IT老高 更新时间:2023-10-28 23:51:32 28 4
gpt4 key购买 nike

ms-access 或类似的东西中是否有 group_concat 函数?

最佳答案

您应该问问自己是否需要通用解决方案 ( another is by Allen Browne ),或者您是否需要它只是为了目前的目的。如果您真的只需要这一次,请采用简单的方法。

旁注,在 VBA 代码中连接列表时,利用长期 Access 专家 Trevor Best 教给我的一个技巧,即在每个值的开头添加分隔符,然后使用 Mid()将其剥离。而不是通过子记录循环内部:

  If Len(strOutput) = 0 Then
strOutput = NewValue
Else
strOutput = strOutput & ", " & NewValue
End If

...在循环中使用它:

  strOutput = strOutput & ", " & NewValue

...然后当您退出循环时,去掉前导分隔符:

  strOutput = Mid(strOutput, 3)

这对所有地方都有影响,并简化了在大量上下文中进行连接的代码。

关于sql - ms-access 中有 group_concat 函数吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2852892/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com