select count(*) from nl_received where received not in (select received from eg_received) ;
-create table nl_new as select * from nl_received where received not in (select received from eg_received) ;
+create temporary table nl_new as select * from nl_received where received not in (select received from eg_received) ;
-select time,mac,addr,"nodeId",json,_id,sensor_type from nodelog where _id in (select _id from nl_new);
+select to_timestamp((json->>'received')::int8/1000), time,mac,addr,"nodeId",json,_id,sensor_type from nodelog where _id in (select _id from nl_new);
+
+select count(*) from nl_new ;
+
+begin;
+
+insert into eg5120 select to_timestamp((json->>'received')::int8/1000) as time,mac,addr,"nodeId",json,sensor_type from nodelog where _id in (select _id from nl_new);
---insert into eg5120 select time,mac,addr,"nodeId",json,sensor_type from nodelog where _id in (select _id from nl_new);