Re: select .... where 1 = 2
Posted in 1996
Topics: SQL Development & Query Writing, Server Administration
In article <4fg07c$pq@cssun.mathcs.emory.edu>, aaron@silo-alcazar.com says...
>(grossly oversimplified):
> select field1, field2 from a,b
> where f3 = f4 and printed_date is null and "A" = $pass_param dummy_inv
> union
> select field-from-as-above
> where f3 = f4 and invoice num = $inv and "S" = $pass_param 312
> I've conducted an experiment using dbaccess with just the "A" case
> and, during a normal join, the select returns no records if
> $pass_param is "B", as it is supposed to do, but make it outer and
> it fails, giving records when I don't want any. Any thoughts?
You didn't give us the OUTER JOIN query! The above query should work as you
said it did, HOWEVER, an OUTER JOIN will always give all the rows that qualify
for the table; for example if A OUTER B and table B contains the printed_date ALL
table A rows will be returned. You may (big unknown here -- haven't used INFORMIX
outer joins long) may need something along the lines of:
( A.col1 = A.col1 and "A" = $pass param )