Subject | Re: [firebird-support] firebird sql alias for condition |
---|---|
Author | Mark Rotteveel |
Post date | 2013-06-21T12:04:48Z |
On Fri, 21 Jun 2013 13:45:51 +0200, "Olaf Kluge" <olaf.kluge@...>
wrote:
SELECT FIRST 1 tmp
FROM (
select cast(d_ein || ' ' || z_ein as timestamp) as tmp from
t_zeitschaltuhr order by tmp
)
WHERE tmp > 'now'
into :tmp_next_e;
Mark
wrote:
> I did the following:'now'
>
> select first 1 cast(d_ein || ' ' || z_ein as timestamp) as tmp from
> t_zeitschaltuhr order by tmp into :tmp_next_e;
>
> select first 1 cast(d_aus || ' ' || z_aus as timestamp) as tmp from
> t_zeitschaltuhr order by tmp into :tmp_next_a;
>
> d_ein is a date, z_ein a time, I would like a timestamp and get the next
> after now. (Time to switch the machine next time off and on:
>
> This time should be the next in the future, so I thought: where tmp >
> , but I can't use the alias for the condition. What can I do?You need to use it as a subquery, eg (untested):
>
SELECT FIRST 1 tmp
FROM (
select cast(d_ein || ' ' || z_ein as timestamp) as tmp from
t_zeitschaltuhr order by tmp
)
WHERE tmp > 'now'
into :tmp_next_e;
Mark