【问题标题】:SQL Access, Concatenate fields within querySQL Access,在查询中连接字段
【发布时间】:2018-06-04 14:04:27
【问题描述】:

是否可以使用 sql 访问(使用 excel 查询)连接我的查询中的字段。

我目前的查询是:

 Select *
 FROM [table$]

但是如何添加一个连接 colA&"|"&colB&"|"&colC&"|"&colD 的新字段

谢谢。

【问题讨论】:

    标签: sql ms-access


    【解决方案1】:

    你似乎明白这个表达;只需将其添加到select

    select t.*, (t.colA & "|" & t.colB & "|" & t.colC & "|" & t.colD) as new_field
    from [table$] as t;
    

    【讨论】:

    • 或者你可以使用动态sql,但是土豆puhtahtoe
    • 谢谢!工作,但似乎我需要像 [colA] 一样将 colA 放在 [] 中,我也可以添加一个 where 查询来查询这个新字段吗?
    • @excelguy。 . .您可以在 where 子句中添加过滤。但是new_field 不可用,除非您使用子查询。
    • @GordonLinoff ,你能帮我解决这个问题吗?有问题,stackoverflow.com/questions/50683970/…
    猜你喜欢
    • 2011-06-14
    • 2019-02-15
    • 2013-07-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多