You are here: Re: Get previous record « MsSQL Server « IT news, forums, messages
Re: Get previous record

Posted by teddysnips on 12/05/05 11:52

MC wrote:
> Here si one way of doing it.
>
> SELECT *
> FROM tblTest
> WHERE
> fldCLocktime = (select max(ClockTime) from tblTest where clocktime <
> '02/01/2005 12:34' and fldEmployeeID = 1)
> AND
> fldEmployeeID = 1

Hi MC

Your response put me onto another way that doesn't use a sub-query:

SELECT TOP 1 *
FROM tblTest WHERE fldClocktime <
'02/01/2005 12:34' and fldEmployeeID = 1
ORDER BY fldClocktime DESC

Both methods work fine - thanks for your help.

Edward

 

Navigation:

[Reply to this 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

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