Re: where clause help

From: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
To: "Ketema" <ketema(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: where clause help
Date: 2007-04-24 00:46:56
Message-ID: 8C5B026B51B6854CBE88121DBF097A86AB2F12@ehost010-33.exch010.intermedia.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

where num_prods > num_open_issues + num_provisioned + num_canceled

if those columns are nullable (which they don't seem to be) you'd have
to convert the NULLs (i.e. coalesce(num_canceled,0) )

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Ketema
> Sent: Monday, April 23, 2007 4:21 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] where clause help
>
> i have a record set like below:
>
> num_prods|num_open_issues|num_provisioned|num_canceled
> 1|0|1|0
> 2|0|0|2
> 3|0|1|1
> 2|0|1|1
> 1|0|01
> 2|0|0|0
> 3|3|0|0
> 3|0|0|3
> 3|1|0|2
> 3|2|0|1
> 2|0|2|0
>
> Of the list above only row 3 and row 6 should be returned.
>
> Plain english definition:
> With a result set like above eliminate all rows that should not show
> up on the provision List. Provision List Definition: All rows that
> have products that need provisioning. Provisioning means its NOT
> canceled and it does NOT have an open issue. Some facts:
> num_open_issues + num_provisioned + num_canceled will never be more
> than num_prods.
> no individual column will ever be more than num_prods.
>
> thanks!
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ketema 2007-04-24 01:00:06 Re: where clause help
Previous Message Benjamin Arai 2007-04-24 00:45:43 Re: Slow query using simple equality operators