Re: plpgsql return select from multiple tables

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Artis Caune <artis(dot)caune(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: plpgsql return select from multiple tables
Date: 2008-09-10 14:26:13
Message-ID: 20080910142613.GC4399@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Artis Caune escribió:
> Hi,
>
> What is the correct way of writing plpgsql function which needs return
> columns from multiple tables?
>
> e.x.:
> SELECT email FROM emails WHERE id = 1
> SELECT backend FROM backends WHERE id = 1
>
> I need plpgsql function return both email and backend in one line, like:
> SELECT email, backend FROM ...

Hmm, maybe

select email, backend from emails, backends where email.id = 1 and
backend.id = 1;
?

You don't need a plpgsql function for this ...

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Artis Caune 2008-09-10 14:34:18 Re: plpgsql return select from multiple tables
Previous Message Filip Rembiałkowski 2008-09-10 14:20:43 Re: You need to rebuild PostgreSQL using --with-libxml.