MySQL - Search in date records -


i trying make sql situation bellow , have no success. not sure how search solution in google.

table "account manager log"

date                    user_id 2014-10-14 19:12:29     51 2014-11-03 14:46:21     39 2015-08-19 11:20:15     2 2015-09-24 09:21:41     15 

so, in 14-oct-2014, account manager user #51. in 03-nov-2014, account transfered 51 39.

i need make sql return me account mananger in given datetime. example: account manager on 05-jan-2015 14:00? answer user_id = 2.

could 1 point me in right direction please? thank you

easy solution select records date less 1 want, sort them in descending order, , limit 1 record :)

select * "account manager log" date <= '03/19/2014'  order date desc limit 1 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -