🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: bit.listserv.sqlinfo
2 messages
2 total messages Started by Greg Doherty Fri, 23 Aug 2002 18:20
SQL Syntax Question
#255
Author: Greg Doherty
Date: Fri, 23 Aug 2002 18:20
14 lines
1296 bytes
Below is the same query written in 2 different ways.  Since I'm specifying
an alias "aaa_no" for the column "Part.lPartNo", I would assume that I
should be able to use that alias in the where clause.  Is my assumption
correct?  Is this valid SQL syntax (SQL - 92)?  If so, I will report it to
my vendor as a bug (Pervasive.SQL 2000i).

WORKS:
SELECT Part.lPartNo AS "aaa_no" FROM Part WHERE Part.lPartNo = 1

DOESN'T WORK:
SELECT Part.lPartNo AS "aaa_no" FROM Part WHERE "aaa_no" = 1

Thanks,
- Greg
Re: SQL Syntax Question
#256
Author: ursidious
Date: Wed, 28 Aug 2002 00:15
24 lines
1753 bytes
no, its not a bug, ansi sql just doesn't allow you to refer to a column
alias in a where clause.



"Greg Doherty" <no spam please> wrote in message
news:umcv5795a4bjac@corp.supernews.com...
> Below is the same query written in 2 different ways.  Since I'm specifying
> an alias "aaa_no" for the column "Part.lPartNo", I would assume that I
> should be able to use that alias in the where clause.  Is my assumption
> correct?  Is this valid SQL syntax (SQL - 92)?  If so, I will report it to
> my vendor as a bug (Pervasive.SQL 2000i).
>
> WORKS:
> SELECT Part.lPartNo AS "aaa_no" FROM Part WHERE Part.lPartNo = 1
>
> DOESN'T WORK:
> SELECT Part.lPartNo AS "aaa_no" FROM Part WHERE "aaa_no" = 1
>
> Thanks,
> - Greg
>
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads