Re: Getting the count(*) from two tables and two date ranges in same query

From: nathan wagner <nw(at)hydaspes(dot)if(dot)org>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Getting the count(*) from two tables and two date ranges in same query
Date: 2008-01-28 15:00:22
Message-ID: 479DEE06.8060605@hydaspes.if.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Håkan Jacobsson wrote:

> I don't get it=). How do I input the second daterange in this query?

Through whatever mechanism you are using to issue the query.

> Also, I have the ID from table1. Its known in the query.

Oops. I forgot that part in my reply. So my where clause is
wrong, though easily modified to add "and table1_id = foo".

> Wouldn't I need to use a UNION for this kind of query?

A union will combine rows (if they're compatible) from two queries,
What you are asking is to assemble columns, which is entirely different.

--
nathan wagner
nw(at)hydaspes(dot)if(dot)org
Please don't top-post.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2008-01-28 15:18:17 Re: Getting the count(*) from two tables and two date ranges in same query
Previous Message Håkan Jacobsson 2008-01-28 14:48:15 Re: Getting the count(*) from two tables and two date ranges in same query