Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f1O4PIx49985 for ; Fri, 23 Feb 2001 23:25:18 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1N9VXx20466 for ; Fri, 23 Feb 2001 04:31:33 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f1N9GOw34859 for pgsql-sql@postgresql.org; Fri, 23 Feb 2001 04:16:24 -0500 (EST) (envelope-from news) From: "CM" X-Newsgroups: comp.databases.postgresql.sql Subject: Re: CREATE TABLE AS and ORDER BY Date: Fri, 23 Feb 2001 01:16:20 -0800 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 23 Message-ID: <9759p5$1216$1@news.tht.net> References: <3A7F5AF9.B23DF42F@omega.uta.edu> X-Complaints-To: scrappy@hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 To: pgsql-sql@postgresql.org X-Archive-Number: 200102/378 X-Sequence-Number: 1583 "Joy Chuang" wrote in message news:3A7F5AF9.B23DF42F@omega.uta.edu... > Hi, > > I tried to use CREATE TABLE AS and ORDER BY. The query is as followed: > > create table freshhr21 as > select e.studentid, u.hoursxfer > from enrollmentstatus e, undergradclass u > where e.studentid = u.studentid and e.classtd = '1' > order by u.hoursxfer > > But, it returns error message "ERROR: parser: parse error at or near > "order"". Does "create table as" support "order by" inside of it? > > I am using PostgreSQL 6.5.3. When you CREATE TABLEs you don't say anything about ordering. I should say it doesn't matter what the order is. When you SELECT from the table you can use ORDER BY.