select .... where 1 = 2
Posted in 1996
Topics: SQL Development & Query Writing, Server Administration, Platform-Specific Issues
I have an ace report which is used to print an invoice based on 2
different scenarios. In one case, I want to print all unprinted
invoices. In another, I want to print a specific invoice. At the
moment I'm trying to be clever and use the same report for both
instances. So, what I ended up with is (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
My thought was: with the the report called as "sacego blah A #", I'd
get the first select to work and "sacego blah S #" the second select
would work, the joins creating a single set without temp tables.
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?
AIX 3.2.5
INFORMIX-SQL Version 4.11.UC2
INFORMIX-SQL Version 4.10.UG1
--Aaron Pelton | A person should live forever or die trying.
aaron@silo-alcazar.com | S. Robinson
#include<disclaimer.h> | Silo Music/Alcazar Records