How can I join tables based on timestamp ranges?

1 次查看(过去 30 天)
I have three tables of a few million rows each, as follows:
Table A has one row for each of 1 million devices, with a column with a unique identifier for each device.
Table B has one row for each change of state for each device in Table A. This table includes the unique device id, a unique state id for each row, and the timestamp when the state change occured.
Table C is a table of every mouse click for each device in table A. This table includes the unique device id, a unique mouseclick id for each row, and the timestamp of the mouseclick.
It is trivial to join A to B and A to C based on the device id. What I need help with is joining B to C based on not only the device id, but also the timestamp. What i want to know is, for every mouseclick in Table C, what state was that device in. If the mouseclick occured on or after the timestamp for status ”m”, but before the timestamp for status “n”, it would join to status ”m”.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by