Menu

#462 GROUP BY clause with JOIN clause and DISTINCT clause and combination of implicit/explicit table specification

1.2 Dev Q
open
nobody
None
5
2013-12-02
2013-12-02
cbx
No

I'm testing complex SQLs on Postgres-XC 1.1.
And I found bad SQL that XC doesn't accept.

The SQL is from answer 2 of chapter 17 in SQL puzzle book by Joe Celko.
I simplified it for everyone's reproduction.

db=# CREATE TABLE t1(id INT, a INT);
CREATE TABLE
db=# CREATE TABLE t2(id INT, b INT);
CREATE TABLE
db=# SELECT DISTINCT t2.b FROM t1 JOIN t2 ON t1.id = t2.id GROUP BY b;
ERROR: ORDER/GROUP BY expression not found in targetlist

This SQL is accepted by PostgreSQL 9.2.4.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.