limit with subselect

Поиск
Список
Период
Сортировка
От A B
Тема limit with subselect
Дата
Msg-id dbbf25900807250302u407e49d2t42d29f8dc37a4ff6@mail.gmail.com
обсуждение исходный текст
Ответы Re: limit with subselect  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: limit with subselect  (Sam Mason <sam@samason.me.uk>)
Список pgsql-general
Sorry if this is a double posting, I think the previous message was lost.

I have two tables
T (
id int primary key,
a int,
b int
)

T2 (
id int references T,
c int
);

and I wish to get 20 lines from T  like this

select id,a,b from T where id not in (select id from T2 where c=5) limit 20;

but that does not seem to work. How can I get what I want? What 20
records are selected is not important. I just need 20.

В списке pgsql-general по дате отправления:

Предыдущее
От: "A B"
Дата:
Сообщение: Subselect with limit
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: limit with subselect