Re: sql help

From: "Duncan Adams (DNS)" <duncan(dot)adams(at)vcontractor(dot)co(dot)za>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: sql help
Date: 2001-12-11 10:31:30
Message-ID: C54EF5B83335D311BCB50000C11042B102C8C7D2@vodabemail1.vodacom.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


but after all

SELECT DISTINCT ON (system.name, clust.clust) clust.clust where
clust.clust_id = clust_sys.clust_key
and
clust_sys.sys_key = system.key_system
and
system.location_key = 61 order by system.name

was what i really wanted

thanx anyway, next time i should just read the error.

-----Original Message-----
From: Duncan Adams (DNS) [mailto:duncan(dot)adams(at)vcontractor(dot)co(dot)za]
Sent: Tuesday, December 11, 2001 10:36 AM
To: pgsql-novice(at)postgresql(dot)org
Subject: [NOVICE] sql help

hi all

is there any way of getting around this problem?

SELECT DISTINCT ON (clust.clust) clust.clust where
clust.clust_id = clust_sys.clust_key
and
clust_sys.sys_key = system.key_system
and
system.location_key = 61
order by system.name;

ERROR: SELECT DISTINCT ON expressions must match initial ORDER BY
expressions

would one create a view or perhaps a temp table, and then do a second query
on that.
although i would prefer to just have one SQL statement.
the system.name will always be unique. there will normally be a number of
systems belonging to the cluster in clust.clust.

thanx
duncan.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Browse pgsql-novice by date

  From Date Subject
Next Message Leandro Fanzone 2001-12-11 15:43:08 Multiple IN
Previous Message Duncan Adams (DNS) 2001-12-11 08:35:38 sql help