Subject Re: [firebird-support] Difficult to assign a subject title
Author Helen Borrie
At 11:55 AM 19/05/2006, you wrote:
>Hi,
>
>
>
>How do I get the max invoice date less than the current invoice date in the
>dataset row the server is processing ie:-
>
>
>
> select max (hrsworked.invoicedate)
>
> from hrsworked
>
> where hrsworked.forkliftoid = :ForkliftOID and
>
> hrsworked.invoicedate < "the current invoicedate the sql server is
>currently processing"

How long is a piece of string?

If there is a relationship between HrsWorked and the invoice whose
date you want to refer to, you could use a subquery expression - but
you don't provide enough information to permit an example.

If you have a set already in situ that has "the current invoice"
available, pick up its invoice date into a date/time variable, or
using a method**, and pass it to a parameterised statement, viz.

select max (hrsworked.invoicedate) as Max_HrsWorked
from hrsworked
where hrsworked.forkliftoid = :ForkliftOID and
hrsworked.invoicedate < :MyDateVariable

** e.g. the ParamByName.AsDateTime method available in many Delphi components

./heLen