Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. CREATE TABLE readings (
  2. id int(11) NOT NULL AUTO_INCREMENT,
  3. value double NOT NULL,
  4. created_dt datetime NOT NULL,
  5. device_id int(11) NOT NULL,
  6. PRIMARY KEY (id),
  7. UNIQUE KEY readings_created_dt_483d31a3654ede43_uniq (created_dt,device_id),
  8. KEY readings_device_id_6a03c4ab761154d1_fk_device_id (device_id),
  9. CONSTRAINT readings_device_id_6a03c4ab761154d1_fk_device_id FOREIGN KEY (device_id) REFERENCES device (id)
  10. ) ENGINE=InnoDB AUTO_INCREMENT=138611438 DEFAULT CHARSET=latin1
  11.  
  12. SELECT value, created_dt FROM readings WHERE (created_dt BETWEEN '2019-03-17 19:11:00' AND '2019-03-18 19:11:00' AND (device_id) IN (10, 11, 12));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement