Reply to SQL query question

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация