Good progress

with SQL query done, able to query automatically by system time