Re: Combining queries

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Mark Kelly <pgsql(at)wastedtimes(dot)net>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Combining queries
Date: 2011-02-19 13:47:15
Message-ID: AANLkTikgjJKzvf9thR3EGRDc2gyE0nQvkjWPLN0o-y9L@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Sat, Feb 19, 2011 at 8:25 AM, Mark Kelly <pgsql(at)wastedtimes(dot)net> wrote:

> Hi.
>
> If I have two queries:
>
> SELECT pub_id as id, email FROM publication WHERE email_accepted = TRUE;
>
> and
>
> SELECT contact_id as id, email FROM person WHERE email_accepted = TRUE;
>
> is there any way I could combine these into a single query? I'd like to be
> able to create a view of all email-able entities in the system.
>
>
Hi, Mark.

Take a look at sql UNION--this is not postgresql specific.

Sean

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Thomas Kellerer 2011-02-19 16:13:34 Re: Updating a table field with a consecutive number
Previous Message Mark Kelly 2011-02-19 13:25:48 Combining queries