Re: referencing column names properly

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: "Sill-II, Stephen" <Stephen(dot)Sill-II(at)ost(dot)dot(dot)gov>
Cc: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: referencing column names properly
Date: 2003-02-09 04:38:49
Message-ID: 20030209043849.GA3562@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, Feb 08, 2003 at 18:34:31 -0500,
"Sill-II, Stephen" <Stephen(dot)Sill-II(at)ost(dot)dot(dot)gov> 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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ross J. Reedstrom 2003-02-09 05:50:22 Re: referencing column names properly
Previous Message Roberto Mello 2003-02-09 02:15:10 Re: query help/sugestions