db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Newsham" <jnews...@referentia.com>
Subject RE: names of columns in VALUES
Date Wed, 30 Jan 2008 19:40:26 GMT


> -----Original Message-----
> From: Army [mailto:qozinx@gmail.com]
> Sent: Wednesday, January 30, 2008 9:20 AM
> To: Derby Discussion
> Subject: Re: names of columns in VALUES
> 
> Jim Newsham wrote:
> >
> > It seems there is no way to name the columns produced by the VALUES
> > keyword.
> 
> <snip>
> 
> > Select a, b, c from x, (values ("a", "b", "c")) as y where x.a = y.1;
> 
> Two things with this statement:
> 
>    1. String literals should be enclosed in single quotes

Oops.  :)  

>    2. You can name the columns from the subquery using the AS clause..
> 
> select a, b, c
>    from x, (values ('a', 'b', 'c')) as y (y1,y2,y3)
>    where x.a = y.y1

Ah-ha!  Thanks!  I didn't realize columns from a subquery could be renamed
in that way.  Also thanks to Daniel Debrunner for the tip on getting no
records back.  I'll give these both a try.

Jim



Mime
View raw message