🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Views

#746
From: Martijn Tonies
Date: Thu, 21 Jun 2007 19:51
45 lines
2082 bytes
> > I would like to confirm....
> >
> > 1) You can't use field alliases when selecting field names. (Invalid
> > command. must specify column name for view select expression)
>
> Sure you can, the alias just has to match the declared name:
>
> CREATE VIEW "FOO" (
>   "MEMBERID",
>   "SURNAME",
>   "FIRSTNAME"
> ) AS
>  select "MEMBER"."OID" as "MEMBERID",
>   "MEMBER"."SURNAME", "MEMBER"."FIRSTNAME"
>  from "MEMBER";
>
> And this of course means you can handle same named columns in joined
tables.

I don't even think you have to use the AS part -> this should work:

> CREATE VIEW "FOO" (
>   "MEMBERID",
>   "SURNAME",
>   "FIRSTNAME"
> ) AS
>  select "MEMBER"."OID",
>   "MEMBER"."SURNAME", "MEMBER"."FIRSTNAME"
>  from "MEMBER";


But you do have to declare the column names in the part before the
query expression.


-- 
Martijn Tonies
Database Workbench - the IBConsole alternative!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
Technical Details
Message-ID: <467ad699$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <467a4d5d@newsgroups.borland.com> <467ac816$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,45068512d9ae4593
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Martijn Tonies" <m.tonies@upscene.removethis.com>
Newsgroups: borland.public.interbase.sql
References: <467a4d5d@newsgroups.borland.com> <467ac816$1@newsgroups.borland.com>
Subject: Re: Views
Date: Thu, 21 Jun 2007 21:51:39 +0200
Lines: 47
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1807
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896
NNTP-Posting-Host: 212.238.159.172
Message-ID: <467ad699$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1182455449 212.238.159.172 (21 Jun 2007 12:50:49 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
X-Original-Bytes: 1912