Damon,
"IF" expressions in R:BASE cannot have sub-queries in them. You may need to
SELECT into a variable before your test, or use the WHERE clause. Inspect
the many R:BASE "functions" through the help contents, those that deal with
date and time, and also notice that you automatically get the equivalent of
a DATEDIFF expressed in days if you subtract one date from another.

Here's one way with the ADDYR() function:

SELECT stuff FROM employee WHERE (ADDYR(dob,50)) <= .#DATE

I don't recall when ADDYR() was added as a function, but if it's not in your
version, you can use IYR(date), IYR4(date), IMON(date), or IDAY(date) to
pull integer year, integer 4-digit year, integer month, or integer day of
the month from any date value, or simply use the number of days calculation
through date subtraction:

SELECT stuff FROM employee WHERE ( (.#DATE - dob)  >= (50 * 365.25) )

On Wed, Nov 5, 2008 at 5:27 PM, Gray, Damon <[EMAIL PROTECTED]> wrote:

>  I apologize for the flurry of questions today.  As I said, I'm all of
> "three days old" with RBase.  I'm trying to do a SQL DATEDIFF, but don't
> find that in RBase, so I'm getting today's date with .#DATE, and then
> pulling a Date of Birth "DOB" from the EMPLOYEE table.  I need to see if the
> given employee is over 50 years old, so I'm not allowing for month, day and
> year.  I'm used to DATEDIFF taking care of that for me.  How is this
> calculated in RBase?  Do I need to bust that DATE up into month, day and
> year and do the math on each element of that datatype?
>
>
>
> IF (.#DATE - (SELECT DOB FROM EMPLOYEE) = 50) THEN
>
>             -- Do stuff here
>
> ENDIF
>
>
>
>               wwwww
>
>               (   @  @   )
>
> ------oOO---(_)---OOo------
>
>                 Damon J. Gray
>
>         Business System Services
>
>                Anvil Corporation
>
>                   (360) 937-0770
>
>          oooo0  0oooo
>
>          (        )   (        )
>
> ---------\    (----)     /----------
>
>               \__)   (__/
>
>
>

Reply via email to