如何联接多个表 [英] How to join multiple tables

查看:56
本文介绍了如何联接多个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在q中联接多个表

I'm trying to join multiple tables in q

        a                  b                  c
    key | valuea       key | valueb       key | valuec
     1  |   xa          1  |   xb          2  |   xc
     2  |   ya          2  |   yb          4  |   wc
     3  |   za  

预期结果是

    key | valuea | valueb | valuec
     1  |   xa   |    xb  |   
     2  |   ya   |    yb  |   xc
     3  |   za   |        |   
     4  |        |        |   wc

只需使用即可实现

    (a uj b) uj c

但是有人知道我该如何以功能形式进行操作吗? 我不知道我实际上有多少张桌子

BUT does anyone know how i can do it in functional form? I don't know how many tables i actually have

我基本上需要一个函数,该函数可以遍历列表并将任意数量的键控表粉碎在一起...

I need basically a function that will go over the list and smash any number of keyed tables together...

f:{[x] x uj priorx};
f[] each (a;b;c;d;e...)

任何人都可以帮忙吗?或提出任何建议?

Can anyone help? or suggest anything?

谢谢!

推荐答案

针对您的问题的另一种解决方案,其解决方案也比您的解决方案快一点:

Another solution particular to your problem which is also little faster than your solution:

a(,')/(b; c)

a (,')/(b;c)

这篇关于如何联接多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆