Subject | Re: [firebird-support] MAX function |
---|---|
Author | Thomas Steinmaurer |
Post date | 2008-02-25T14:55:40Z |
Hi Tim,
IF (:TRECORDNO > :OLDRECNO) THEN
Btw, you only need the ':' in front of parameter, variables ... in SQL
statements, but not in assignments, IF conditions, ...
--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com
> I need to get a field value value dependant on the maximum of anotherFrom a syntactical POV, this should be:
> field value.
>
> For example in the following case, I want the BATCH NUMBER value for
> the maximum RECORDNO value.
>
> I have tried the following SQL, but I keep on getting an error
> message (TERMID is an input variable):
>
> FOR SELECT MAX(RECORDNO), BATCHNUM FROM BATCH
> WHERE
> TERMID = :TERMID
> GROUP BY BATCHNUM
> INTO
> :TRECORDNO, :TBATCHNUM
> DO
> BEGIN
> IF :TRECORDNO > :OLDRECNO THEN
IF (:TRECORDNO > :OLDRECNO) THEN
Btw, you only need the ':' in front of parameter, variables ... in SQL
statements, but not in assignments, IF conditions, ...
--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com