pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ross J. Reedstrom <reedstrm@rice.edu>
To: Sill-II, Stephen <Stephen.Sill-II@ost.dot.gov>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: referencing column names properly
Date: Sat, 8 Feb 2003 23:50:22 -0600
Message-ID: <20030209055022.GA6860@wallace.ece.rice.edu> (raw)
In-Reply-To: <4BAE87828F06EB45B2641B83D370350F45E4@ostex002.ad.ost.dot.gov>
References: <4BAE87828F06EB45B2641B83D370350F45E4@ostex002.ad.ost.dot.gov>

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



view thread (5+ messages)  latest in thread

Message-ID: <20030209055022.GA6860@wallace.ece.rice.edu>
Permalink:  ../20030209055022.GA6860@wallace.ece.rice.edu/
Also on:    postgresql.org/message-id/20030209055022.GA6860@wallace.ece.rice.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: reedstrm@rice.edu, Stephen.Sill-II@ost.dot.gov
  Subject: Re: referencing column names properly
  In-Reply-To: <20030209055022.GA6860@wallace.ece.rice.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox