- Original Message -
From: "Joseph Shraibman" <[EMAIL PROTECTED]>
Subject: Re: [SQL] WHERE on an alias
> If I try to put a distinct on in my subselect int the from I get:
>
> ERROR: SELECT DISTINCT ON expressions must match initial ORDER BY
expressions
>
> what does that mean?
You need
Finally figuring that enough is enough, I've been spending the past few
days working on the list archives ...
I've reformatted, so far, the following lists into a cleaner format:
pgsql-hackers
pgsql-sql
pgsql-bugs
pgsql-general
pgadmin-hackers
pga
If I try to put a distinct on in my subselect int the from I get:
ERROR: SELECT DISTINCT ON expressions must match initial ORDER BY expressions
what does that mean?
Tom Lane wrote:
> Joseph Shraibman <[EMAIL PROTECTED]> writes:
>
>>Basically there is the utable, which has two keys in it. I w
Dear all,
Tom's comments on my previous posting encouraged me think some more about
this... and now I believe got to the heart of what I was attempting to get
accross before.
I have a fresh and hopefully clear example.
Ok lets start with a small table called 'dim0' that has a unique key call
jkinsley writes:
> When I add append GROUP BY p2.emp to the query, I no longer get the
> error and the results are returned. Why must I explicitly declare a
> GROUP BY on the query?
Because otherwise it's undefined which p2.emp to return. Consider this
table t1:
a | b
---+---
1 | 5
6 | 2
I am using PostgreSQL to cook the "Nested Set Model of
Trees in SQL' examples from Chapter 29 of Joe Celko's book "SQL For
Smarties". In Section 29.3 ("Finding Levels and Paths in a Tree"),
the following query is used:
SELECT P2.emp FROM (COUNT(p1.emp) - 1) AS level
FROM Person