CREATE TABLE mytable(
id INT PRIMARY KEY AUTO_INCREMENT,
myvalue VARCHAR(10),
mydate DATETIME
)
INSERT INTO mytable(myvalue,mydate) VALUES('a','2014-07-22 14:23:00');
INSERT INTO mytable(myvalue,mydate) VALUES('b','2014-07-22 15:28:00');
INSERT INTO mytable(myvalue,mydate) VALUES('c','2014-07-23 11:23:00');
INSERT INTO mytable(myvalue,mydate) VALUES('d','2014-07-25 14:23:00');
INSERT INTO mytable(myvalue,mydate) VALUES('f','2014-07-26 07:23:00');
INSERT INTO mytable(myvalue,mydate) VALUES('e','2014-07-25 19:26:00');
INSERT INTO mytable(myvalue,mydate) VALUES('g','2014-07-27 14:23:00');
INSERT INTO mytable(myvalue,mydate) VALUES('h','2014-07-27 15:23:00');
INSERT INTO mytable(myvalue,mydate) VALUES('i','2014-07-27 19:51:00');
INSERT INTO mytable(myvalue,mydate) VALUES('k','2014-07-28 14:23:00');
INSERT INTO mytable(myvalue,mydate) VALUES('l','2014-07-29 14:23:00');
--查询23号到28号中每天的最后一条数据的集合,即从这张表中筛选出myvalue为c、e、f、i、k
哎呀,想写个sql真是太难了,心好累。
繁花如伊
子衿沉夜