| 
 Posted by GTi on 11/01/05 10:59 
I have a large table and I want to get a spesific record. 
The table is sorted by timestamp and I have a startdato column. 
 
Now I want to get only one record less or equal to a dato: 
 
idd    startdate 
.... 
122221 2005/01/01 02:35 
122222 2005/01/01 05:01 
122223 2005/01/01 10:19 
122224 2005/01/01 14:10 
122225 2005/01/01 18:49 
.... 
 
Now I want the closest idd (less or equal to 2005/01/01 14:00 Using: 
(the answer is 122222 at 2005/01/01 05:01) 
SELECT idd FROM datetable WHERE startdate <= '2005/01/01 14:00:00' 
gives me all the record from the beginning of the table. But I only 
need the records nearest (less or equal). 
 
Any idea?
 
[Back to original message] 
 |