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

Posted by MC on 12/05/05 12:18

Yes, it works if you're running the query for one employee. I thought you
needed something for all employees or something like that. Oh well, as long
as you managed to solve the problem :).

MC


<teddysnips@hotmail.com> wrote in message
news:1133776339.305365.292690@g14g2000cwa.googlegroups.com...
>
> 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

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