database - How to select first record prior/after a given timestamp in KDB? -


i pulling in records 1min leading timestamp (e.g. if timestamp i'm interested in 2014.04.14t09:30):

select prices timestamp within 2014.04.14t09:29 2014.04.14t09:30, stock=`goog 

however, not robust. previous record may @ 09:25am , query returns nothing. query may return hundreds of records if there have been lot of price changes, though need last record returned.

i know can done asof join, want avoid time being prices big @ present.

i interested in doing same, in finding first record after given timestamp.

note prices splayed table

select last record before given timestamp:

q)select price timestamp<2014.04.14t09:30,stock=`goog,i=last 

select first record after given timestamp:

q)select price timestamp>2014.04.14t09:30,stock=`goog,i=first 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -