Function as Phantom Field

Поиск
Список
Период
Сортировка
От Charles Tassell
Тема Function as Phantom Field
Дата
Msg-id 4.3.2.7.2.20001013043956.04c87180@mailer.isn.net
обсуждение исходный текст
Список pgsql-general
I have a database like this:

CREATE TABLE articles (
         article_id      serial primary key,
         title           text
);

CREATE TABLE pages (
         article_id      integer,
         page            text
);

And I want to be able to do a

SELECT article_id, title, count_pages(article_id) FROM articles

Now, I have already written the count_pages function (it's just a count(*)
where article_id = $1) but I don't know how to do the SELECT in one pass,
is there some way I can do this with triggers or is there a special field
name I can use to specify the current article_id as the function argument?






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

Предыдущее
От: Fabrice Pollet
Дата:
Сообщение: cache lookup failed
Следующее
От: Tomas Berndtsson
Дата:
Сообщение: Re: Function as Phantom Field