Subject Re: column does not belong to referenced table
Author Adam
--- In firebird-support@yahoogroups.com, "markd_mms" <spam@m...>
wrote:
>
> I'm trying to select records where the CCEXPIRYDATE has past or is
> within the next 30 days like so...
>
> SELECT NAME, CCEXPIRYDATE,
> CAST(CCEXPIRYDATE-CURRENT_DATE AS INTEGER) AS DAYSPAN
> FROM SUBSCRIBERS
> WHERE DAYSPAN <= 30
>
> I get an error saying Column unknown DAYSPAN and that it doesn't
> belong to a referenced table. But I figure I can't change it to
WHERE
> 3 <= 30 because it sems as though it interprets 3 as a number rather
> than a column.
>
> Is there any way of getting around this?
>

Why not this:

SELECT NAME, CCEXPIRYDATE,
CAST(CCEXPIRYDATE-CURRENT_DATE AS INTEGER) AS DAYSPAN
FROM SUBSCRIBERS
WHERE CCEXPIRYDATE <= (CURRENT_DATE + 30)

Adam