Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group