X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 75B024758DC for ; Sun, 9 Feb 2003 00:50:20 -0500 (EST) Received: from ece.rice.edu (ece.rice.edu [128.42.4.34]) by postgresql.org (Postfix) with ESMTP id 0715647580B for ; Sun, 9 Feb 2003 00:50:20 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by ece.rice.edu (Postfix) with SMTP id 9821D68A76; Sat, 8 Feb 2003 23:50:25 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by ece.rice.edu (Postfix) with ESMTP id 1219F68A75; Sat, 8 Feb 2003 23:50:25 -0600 (CST) Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154]) by ece.rice.edu (Postfix) with ESMTP id 6F94368A74; Sat, 8 Feb 2003 23:50:23 -0600 (CST) Received: from reedstrm by wallace.ece.rice.edu with local (Exim 3.36 #1 (Debian)) id 18hkMB-0001oP-00; Sat, 08 Feb 2003 23:50:23 -0600 Date: Sat, 8 Feb 2003 23:50:22 -0600 From: "Ross J. Reedstrom" To: "Sill-II, Stephen" Cc: "'pgsql-sql@postgresql.org'" Subject: Re: referencing column names properly Message-ID: <20030209055022.GA6860@wallace.ece.rice.edu> Mail-Followup-To: "Ross J. Reedstrom" , "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.4i X-Virus-Scanned: by AMaViS snapshot-20020300 X-DCC--Metrics: ece.rice.edu 1067; Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/176 X-Sequence-Number: 11574 On Sat, Feb 08, 2003 at 06:34:31PM -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; SELECT "User-Name", max("Date"), max("Time") from logs; Assuming the MulTiCasIng you show is also in the table. SQL lets you put anything at all in an identifier (table or column name) as long as you quote it with double-quotes (") Ross