Subject RE: [firebird-support] Sql query help
Author Darryl West
Also, a common gotcha when UNIONing is that it works a little differently to
a non-UNION SELECT. UNIONs return a DISTINCT result set by default, so I
suggest that you might want to use the ALL predicate, eg,

SELECT ....
FROM ...
UNION ALL
SELECT ....
FROM ...
GROUP BY ...

Regards,

Darryl

-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Thursday, 22 January 2004 4:19 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Sql query help


At 05:16 AM 22/01/2004 +0000, you wrote:
>Thanx for the prompt reply.
>But even if I put one order by clause after all select it is giving me
>'invalid order by clause' error.
>
>create procedure...

as
declare variable var1 date;
declare variable var2 whatever;

>begin
> for
> select (current_date - col1) , col2 from table1 where col1< current_date
> union
> select (current_date - col1), col2 from table1 where col1< current_date
> order by col1

into :var1, :var2

> do
> suspend;
>end
>/*col1 is a date field*/