Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Example with UNION
Fri, Nov 16 2007 1:09 PMPermanent Link

Dieter Nagy
Hello,
with DBISAM work this fine:

Select Z1 as ZValues
into TotalTest
from lotto
union all
Select Z2 as ZValues
from lotto
union all
select Z3 as ZValues
from lotto
union all
select Z4 as ZValues
from lotto
union all
select Z5 as ZValues
from lotto
union all
Select Z6 as Zvalues
from lotto
Order by ZValues ;

select ZValues, count(Zvalues) as ZFreq
from TotalTest
group by Zvalues;

select zvalues,count(zvalues) as zfreq
into SU
from totaltest
group by zvalues;

Please show me how can I do this with elevateDB 1.06. I can't find an example.

TIA
Dieter Nagy
Fri, Nov 16 2007 5:43 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Dieter,

Do you want the SU result set to be returned from the script ?  Also, what's
with the second SQL SELECT ?  It doesn't seem to do anything at all.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Nov 16 2007 11:44 PMPermanent Link

Dieter Nagy
Tim,
yes I want the SU result set returned from the script.

Tahnks
Dieter Nagy


"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

Dieter,

Do you want the SU result set to be returned from the script ?  Also, what's
with the second SQL SELECT ?  It doesn't seem to do anything at all.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Nov 19 2007 3:10 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Dieter,

<< yes I want the SU result set returned from the script. >>

Okay, use this:

SCRIPT
BEGIN
  DECLARE Result CURSOR WITH RETURN FOR Stmt;
  EXECUTE IMMEDIATE 'CREATE TEMPORARY TABLE TotalTest AS
                    Select Z1 as ZValues
                    from lotto
                    union all
                    Select Z2 as ZValues
                    from lotto
                    union all
                    select Z3 as ZValues
                    from lotto
                    union all
                    select Z4 as ZValues
                    from lotto
                    union all
                    select Z5 as ZValues
                    from lotto
                    union all
                    Select Z6 as Zvalues
                    from lotto';
  PREPARE Stmt FROM 'select zvalues,count(zvalues) as zfreq
                    from totaltest
                    group by zvalues';
  OPEN Result;
END

Be sure to DROP the TotalTest temporary table after you're done with the
result set.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Nov 21 2007 10:04 AMPermanent Link

Dieter Nagy
Thanks Tim

Dieter





"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

Dieter,

<< yes I want the SU result set returned from the script. >>

Okay, use this:

SCRIPT
BEGIN
  DECLARE Result CURSOR WITH RETURN FOR Stmt;
  EXECUTE IMMEDIATE 'CREATE TEMPORARY TABLE TotalTest AS
                    Select Z1 as ZValues
                    from lotto
                    union all
                    Select Z2 as ZValues
                    from lotto
                    union all
                    select Z3 as ZValues
                    from lotto
                    union all
                    select Z4 as ZValues
                    from lotto
                    union all
                    select Z5 as ZValues
                    from lotto
                    union all
                    Select Z6 as Zvalues
                    from lotto';
  PREPARE Stmt FROM 'select zvalues,count(zvalues) as zfreq
                    from totaltest
                    group by zvalues';
  OPEN Result;
END

Be sure to DROP the TotalTest temporary table after you're done with the
result set.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image