help on query - Mailing list pgsql-general

From Sziklai Gabor
Subject help on query
Date
Msg-id 001501c2bf42$082b5700$ce6641d9@gabika
Whole thread Raw
List pgsql-general
Greetings,

There are several methods:

1/
SELECT idTableB FROM B WHERE idTableA =1
EXCEPT
SELECT idTableB FROM B WHERE idTableA =2


2/
SELECT idTableB, MAX(idTableA)
FROM B
GROUP BY idTableB
HAVING MAX(idTableA) = 1

3/
SELECT idTableB FROM
(SELECT DISTINCT ON (idTableB) idTableB, idTableA
FROM B
ORDER BY idTableB, idTableA DESC) aa
WHERE idTableA = 1

Gabor


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: point -> double,double ?
Next
From: "Ben-Nes Michael"
Date:
Subject: libpq.so.2.2 & libpq.so.3.0