Received: from server (client-sp03-85.speedex.net [208.33.90.85]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f3E78D849782 for ; Sat, 14 Apr 2001 03:08:19 -0400 (EDT) (envelope-from will@serensoft.com) Received: from will by server with local (Exim 3.12 #1 (Debian)) id 14oKA9-0006Wt-00 for ; Sat, 14 Apr 2001 02:08:05 -0500 Date: Sat, 14 Apr 2001 02:08:05 -0500 From: will trillich To: pgsql-general@postgresql.org Subject: Re: Order in CREATE VIEW Message-ID: <20010414020805.C24922@serensoft.com> Mail-Followup-To: pgsql-general@postgresql.org References: <9b148t$l66$1@news.tpi.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <9b148t$l66$1@news.tpi.pl>; from marcingrupy@poczta.onet.pl on Wed, Apr 11, 2001 at 10:25:24AM +0200 X-Archive-Number: 200104/571 X-Sequence-Number: 7719 On Wed, Apr 11, 2001 at 10:25:24AM +0200, Marcin Wasilewski wrote: > hello everybody, > Can you help me? > > I have POSTGRESQL 7.0.3, > I try to create simple view by typing. > > create view "xx" as select "aa.yy", "bb.yy" from "yy" order by "bb.yy" > > the problem is that parameter order is not implemented with create view. > so how can I create such simple query?? unless your table "yy" has fields "aa.yy" and "bb.yy" (or something like "first name" or "client's phone") i'd start by revising that to something like: create view "xx" as select "aa"."yy", "bb"."yy" from "yy" order by "bb"."yy" ; but even there you still have problems: table aa field yy table bb field yy -> the names will collide (two fields named yy in the view) plus, there's no definition of how the two tables relate to each other. not knowing what your example is based on, how about something like this... create view xx as -- and here comes a regular old SELECT statement: select aa.yy as aa_yy_or_whatever, bb.yy as bb_yy_you_get_the_idea from aa, bb where aa.somefield = bb.otherfield order by bb.yy ; -- americans should never read anything so subversive as what's at http://www.salon.com/people/col/pagl/2001/03/21/spring/index1.html will@serensoft.com http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!