X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0AF57475AA1 for ; Sat, 8 Feb 2003 23:26:37 -0500 (EST) Received: from wolff.to (wolff.to [66.93.249.74]) by postgresql.org (Postfix) with SMTP id D1242475AD4 for ; Sat, 8 Feb 2003 23:25:41 -0500 (EST) Received: (qmail 3647 invoked by uid 500); 9 Feb 2003 04:38:49 -0000 Date: Sat, 8 Feb 2003 22:38:49 -0600 From: Bruno Wolff III To: "Sill-II, Stephen" Cc: "'pgsql-sql@postgresql.org'" Subject: Re: referencing column names properly Message-ID: <20030209043849.GA3562@wolff.to> Mail-Followup-To: "Sill-II, Stephen" , "'pgsql-sql@postgresql.org'" References: <4BAE87828F06EB45B2641B83D370350F45E4@ostex002.ad.ost.dot.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BAE87828F06EB45B2641B83D370350F45E4@ostex002.ad.ost.dot.gov> User-Agent: Mutt/1.3.25i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/175 X-Sequence-Number: 11573 On Sat, Feb 08, 2003 at 18:34:31 -0500, "Sill-II, Stephen" wrote: > I have a table called logs with several columns whose names have '-' in > them, e.g. User-Name > > I'm having trouble referencing these columns with SELECT statements. > > What would the proper way to address these in a statement like this? > > SELECT User-Name, max(Date), max(Time) from logs; You need to use double quotes around the column name. When you do that case will become significant. If you didn't quote the column name on the create table command, then the name would have been converted to lower case.