I have a table which looks like this:
CREATE TABLE `t_test` (
`T_REGION_ID` int(16) NOT NULL default '0',
`VALID_FROM` varchar(5) NOT NULL default '',
`TXT1` varchar(50) NOT NULL default '',
`DATE_CREATED` datetime NOT NULL default '0000-00-00 00:00:00'
) TYPE=MyISAM;
in the db there are always "7 record-sets" written for the same "DATE_CREATED", but each of those records contains a different "VALID_FROM" entry.
i.e.
(1, '10:00','text 1','2003-01-01 10:10:10');
(1, '10:30','text 2','2003-01-01 10:10:10');
(1, '11:00','text 3','2003-01-01 10:10:10');
(1, '11:30','text 4','2003-01-01 10:10:10');
(1, '12:00','text 5','2003-01-01 10:10:10');
(1, '12:30','text 6','2003-01-01 10:10:10');
(1, '13:00','text 7','2003-01-01 10:10:10');
(1, '20:00','text 1','2003-02-02 20:20:20');
(1, '20:30','text 2','2003-02-02 20:20:20');
(1, '21:00','text 3','2003-02-02 20:20:20');
(1, '21:30','text 4','2003-02-02 20:20:20');
(1, '22:00','text 5','2003-02-02 20:20:20');
(1, '22:30','text 6','2003-02-02 20:20:20');
(1, '23:00','text 7','2003-02-02 20:20:20');
how can i get now from each of those "7 record-sets" with the same DATE_CREATED only the first 4 records??
--> the result should look like this:
(1, '10:00','text 1','2003-01-01 10:10:10');
(1, '10:30','text 2','2003-01-01 10:10:10');
(1, '11:00','text 3','2003-01-01 10:10:10');
(1, '11:30','text 4','2003-01-01 10:10:10');
(1, '20:00','text 1','2003-02-02 20:20:20');
(1, '20:30','text 2','2003-02-02 20:20:20');
(1, '21:00','text 3','2003-02-02 20:20:20');
(1, '21:30','text 4','2003-02-02 20:20:20');
I just can't get it running... tryed with GROUP_BY, LIMIT, ... simply can't figure it out!
Anyone can help? Thanx!
CREATE TABLE `t_test` (
`T_REGION_ID` int(16) NOT NULL default '0',
`VALID_FROM` varchar(5) NOT NULL default '',
`TXT1` varchar(50) NOT NULL default '',
`DATE_CREATED` datetime NOT NULL default '0000-00-00 00:00:00'
) TYPE=MyISAM;
in the db there are always "7 record-sets" written for the same "DATE_CREATED", but each of those records contains a different "VALID_FROM" entry.
i.e.
(1, '10:00','text 1','2003-01-01 10:10:10');
(1, '10:30','text 2','2003-01-01 10:10:10');
(1, '11:00','text 3','2003-01-01 10:10:10');
(1, '11:30','text 4','2003-01-01 10:10:10');
(1, '12:00','text 5','2003-01-01 10:10:10');
(1, '12:30','text 6','2003-01-01 10:10:10');
(1, '13:00','text 7','2003-01-01 10:10:10');
(1, '20:00','text 1','2003-02-02 20:20:20');
(1, '20:30','text 2','2003-02-02 20:20:20');
(1, '21:00','text 3','2003-02-02 20:20:20');
(1, '21:30','text 4','2003-02-02 20:20:20');
(1, '22:00','text 5','2003-02-02 20:20:20');
(1, '22:30','text 6','2003-02-02 20:20:20');
(1, '23:00','text 7','2003-02-02 20:20:20');
how can i get now from each of those "7 record-sets" with the same DATE_CREATED only the first 4 records??
--> the result should look like this:
(1, '10:00','text 1','2003-01-01 10:10:10');
(1, '10:30','text 2','2003-01-01 10:10:10');
(1, '11:00','text 3','2003-01-01 10:10:10');
(1, '11:30','text 4','2003-01-01 10:10:10');
(1, '20:00','text 1','2003-02-02 20:20:20');
(1, '20:30','text 2','2003-02-02 20:20:20');
(1, '21:00','text 3','2003-02-02 20:20:20');
(1, '21:30','text 4','2003-02-02 20:20:20');
I just can't get it running... tryed with GROUP_BY, LIMIT, ... simply can't figure it out!
Anyone can help? Thanx!