Query Formulation Question

From: <operationsengineer1(at)yahoo(dot)com>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Query Formulation Question
Date: 2006-05-12 22:30:21
Message-ID: 20060512223021.46448.qmail@web33311.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

consider the following simplified queries (php using
heredoc):

$sql_1 = <<<_EOSQL

select count(inspect)
from t_inspect, t_product, t_test_area
where t_product.product_num = 1
and t_test_area.id = 5

_EOSQL

$sql_2 = <<<_EOSQL

select count(inspect)
from t_inspect, t_product, t_test_area
where t_product.product_num = 1

_EOSQL

what is the best way to handle both of these cases in
one statement?

i know it would take the form of $sql_1, but what
value should i feed to t_test_area.id? is there
syntax that will just ignore it or do i need to send a
value of 'NOT NULL'? will NOT NULL slow down the
query when compared to $sql_2?

am i missing a better way to structure these queries?

as always, tia...

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Sean Davis 2006-05-13 00:30:01 Re: Query Formulation Question
Previous Message Tom Lane 2006-05-12 15:09:33 Re: Wondering if anyone could help me