q lang - (kdb+/q) Is it possible to join or combine rows? -


here situation: have data table looks this:

symbol    date          time             sequence       type ---------------------------------------------------------------------------      2013.06.06      20:00:00.137   36654383         bestask      2013.06.06      20:00:00.137   36654383         bestbid      2013.06.07      04:00:00.788   3                bestask      2013.06.07      04:00:00.788   3                bestbid      2013.06.07      04:00:00.788   3                bestask      2013.06.07      04:00:00.788   3                bestbid      2013.06.07      07:01:09.584   43126            bestask      2013.06.07      07:01:09.584   43126            bestbid      2013.06.07      07:02:09.012   43431            bestask      2013.06.07      07:02:09.012   43431            bestbid 

as can tell, rows come in pairs. each bestask , bestbid row has same symbol date time , sequence. since sorted nicely, thinking rows can combined in relation order, join commands looked @ combine columns(aj,aj0,etc). tried flipping table dictionary , combining in dictionary form have been unsuccesful.

what looking in result identical values symbol date time sequence don't have duplicated in type column, show bestask , bestbid :

symbol   date          time             sequence       type ---------------------------------------------------------------------------      2013.06.06      20:00:00.137   36654383          bestask,bestbid      2013.06.07      04:00:00.788   3                bestask,bestbid      2013.06.07      04:00:00.788   3                bestask,bestbid      2013.06.07      07:01:09.584   43126            bestask,bestbid      2013.06.07      07:02:09.012   43431            bestask,bestbid 

something this, thank you!

select distinct type symbol,date,time,sequence table 

or use xgroup


Comments