Home > Net >  KDB combine/join different table
KDB combine/join different table

Time:07-28

How can i join two different table like all_order_ask:([]ask:();ask_qty:();exchange_name_ask:()) all_order_bid:([]bid:();bid_qty:();exchange_name_bid:())

and get =====>

final_order:ask:();ask_qty:();exchange_name_ask:();bid:();bid_qty:();exchange_name_bid:()

the two table have the same number of rows

CodePudding user response:

you can use uj: https://code.kx.com/q/ref/uj/

all_order_ask uj all_order_bid
ask ask_qty exchange_name_ask bid bid_qty exchange_name_bid
-----------------------------------------------------------
q)

CodePudding user response:

Since your two tables have the same number of rows, you should also be able to join your two tables horizontally using ,' as follows:

q)final_order_ask:all_order_ask,'all_order_bid
q)final_order_ask
ask ask_qty exchange_name_ask bid bid_qty exchange_name_bid
-----------------------------------------------------------
  • Related