View previous topic :: View next topic
|
Author |
Message |
chitra_chaturvedi
New User
Joined: 24 Jul 2007 Posts: 18 Location: india
|
|
|
|
Hi,
Please consider following querry.
Select *
From table T
Where A = Var1 and
B = Var2.
Now if I have a scenario where I get Value for only Var1 and in another scenario for value for only VAR2. Is there a way to accomplish all 3 scenarios in a single query? Or I have to use 3 different queries like
Select *
From table T
Where A = Var1
Select *
From table T
Where A = Var2
Select *
From table T
Where A = Var1 and
B = Var2.
Please Suggest. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
why the demand for only 1 complex query?
using cobol flow control instructions
would enable an optimum query to be invoked.
otherwise, you are making the query complex
and 'slower' - more db2 resource intensive.
the extra seconds for the cobol to decide which query to use
would have a smaller impact on the machine - thus more time for others
than a complex query. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
Or I have to use 3 different queries like
Select *
From table T
Where A = Var1
Select *
From table T
Where A = Var2
Select *
From table T
Where A = Var1 and
B = Var2. |
it is hard to take people seriously,
when they can not even bother to be precise with their requirements.
but one example is here |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
|