select distinct - Mailing list pgsql-general

From Tim Joyce
Subject select distinct
Date
Msg-id 009701bf6c8b$95b6c3a0$0501a8c0@noonoo
Whole thread Raw
In response to Re: [GENERAL] SQL Book  (<kaiq@realtyideas.com>)
Responses RE: [GENERAL] select distinct  ("Sean Carmody" <sean@categoricalsolutions.com.au>)
List pgsql-general
Hi,

I am running this query and expecting distinct results

ebmh=> SELECT DISTINCT articles.id FROM articles, paragraphs WHERE
paragraphs.ar
ticle_key = articles.id and paragraphs.paragraph ~* 'dementia' ORDER BY
articles
.page_no;
id
--
 4
 4
 4
 4
16
12
12
12
12
12
 3
 3
 3
(13 rows)

however, if i remove the ORDER BY, it works

ebmh=> SELECT DISTINCT articles.id FROM articles, paragraphs WHERE
paragraphs.ar
ticle_key = articles.id and paragraphs.paragraph ~* 'dementia';
id
--
 3
 4
12
16
(4 rows)

this is in 6.4 and 6.5.2, am i doing something wrong?

Cheers

Tim Joyce
Chief Enthusiast
tim@hoop.co.uk
HOOP Ltd
http://www.hoop.co.uk
01202 251 816

HOOP is proud to be a member of the Paneris community (www.paneris.co.uk)





pgsql-general by date:

Previous
From: Arnaud FLORENT
Date:
Subject: [GENERAL] COPY performance...
Next
From: Yury Don
Date:
Subject: error with operator ~~ for varchar