Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Condition

Status
Not open for further replies.

21128

Programmer
Aug 27, 2009
36
US
I have a condition in my query

Select .........
from
log_entries
where
UPPER( '{?IncludeStatus}') = UPPER('Yes') and
log_id =
CASE {?Log_ID} WHEN 6 THEN 25
WHEN 31 THEN 33
WHEN 27 THEN 29
WHEN 39 THEN 41
WHEN 35 THEN 37 ELSE -1 END

If the user selects {?IncludeStatus}=Yes and enters {?Log_id}=6 then it displays the value of 25.
Is there some way here in the query conditon above, if the user choose {?IncludeStatus}=Yes and user
select for example {?Log_ID}=6 then the result should give not only 25 but both 6 and 25 togeter or if user select
{?Log_ID}=31 then the result should give both 31 and 33 togeter

Thanks
 
Hi,
try somethinbg like:
Code:
Select .........
from
 log_entries
where
 UPPER( '{?IncludeStatus}') = "YES"
AND
 (
  log-id = {?LOG_ID} OR 
  log_id = 
   CASE {?Log_ID} WHEN 6 THEN 25
    WHEN 31 THEN 33
    WHEN 27 THEN 29 
    WHEN 39 THEN 41
    WHEN 35 THEN 37 
    ELSE -1
  END
)


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
If you want to show both values on your report, display both {?LOG_ID} and the {log_entries.log_id} field. You don't need to do anything special with the SQL, but you can create a formula if you need to concatenate the values.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Thank You guys
Its working fine now
i used union
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top