Mayar Alzerki
Mayar Alzerki

Reputation: 27

How to query on multiple queries in KDB+?

In KDB+, I have multiple tables in tables[] that have the same name prefix. For example, I have 8 tables that start with the word 'users_'. The full name is something like 'users_1', 'users_2', etc.

I want to perform the following query:

```select regestration_date from tables[] where tables[] like "users_*"```

How can I get the same result since the query mentioned above is not working, I get type error.

Note: I do not want to perform join because number of tables are big and the tables have a lot of records, so the resulted table will be huge.

Thank you!

Upvotes: 0

Views: 80

Answers (1)

Thomas Smyth
Thomas Smyth

Reputation: 5644

Easiest way to accomplish this is with a lambda and each.

raze {select regestration_date from x} each tables[] where tables[] like "users_*"

raze will collapse the individual outputs to a single table.

Upvotes: 2

Related Questions