🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11215

Re: View based on a UNION of 2 Select's

#11215
From: Martijn Tonies
Date: Wed, 11 Dec 2002 17:30
95 lines
2693 bytes
Hi,

What version of IB are you using? I recall a bug in earlier versions
that messed up the PLAN that IB returned.


--

With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase & Firebird
Firebird Workbench - the developer tool for Firebird
Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."

>
>   I Have the following tables and view :
>
> CREATE TABLE TAB1
> (
>   COD INTEGER NOT NULL,
>   DESCR VARCHAR(10),
>   CODTAB INTEGER,
>   TYPETAB VARCHAR(1)
> );
>
> CREATE TABLE TAB2
> (
>   COD INTEGER NOT NULL,
>   DESCR VARCHAR(10)
> );
>
> CREATE TABLE TAB3
> (
>   COD INTEGER NOT NULL,
>   DESCR  VARCHAR(10)
> );
>
> CREATE VIEW V_TABS
> (
>   COD,
>   DESCR,
>   TYPETAB
> )
> AS
> SELECT
>   COD,
>   DESCR,
>   '2'
>   FROM
>     TAB2
>
> UNION
>
> SELECT
>   COD,
>   DESCR,
>   '3'
>   FROM
>     TAB3;
>
>
>   My problem happens when I try to run the following
> select :
>
> SELECT
>     TAB1.COD,
>     TAB1.DESCR,
>     TAB1.TYPETAB || ' - ' || V_TABS.DESCR
>   FROM
>     TAB1
>     LEFT OUTER JOIN V_TABS
>     ON (  (V_TABS.CODTAB = TAB1.CODTAB)
>         AND
>           (V_TABS.TYPETAB = TAB1.TYPETAB))
>
>   The select return the records I want but my plan analyser tool goes crazy
> and show a lot of unrecognized characters instead of the correct plan. Am I
> doing something wrong ? Can I trust that my select will always work ?
>
> Is there some problem using a VIEW based on a UNION of two SELECT's ? Is it
> safe ?
>
> Do you have some other idea ?
>
> Thanks for reading.
>
> Jose Carlos
> Brazil
>
>
Technical Details
Message-ID: <3df775a5$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3df76de6@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,2f86d9a520aeb76b
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-11 09:36:45 PST
From: "Martijn Tonies" <m.tonies@upscene_remove.com>
Newsgroups: borland.public.interbase.sql
References: <3df76de6@newsgroups.borland.com>
Subject: Re: View based on a UNION of 2 Select's
Date: Wed, 11 Dec 2002 18:30:58 +0100
Lines: 97
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 212.238.179.102
Message-ID: <3df775a5$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1039627685 212.238.179.102 (11 Dec 2002 09:28:05 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail