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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decode 5

Status
Not open for further replies.

lbass

Technical User
Feb 9, 2002
32,816
US
I am trying to write a SQL query in Crystal Reports accessing an Oracle database, and I need to use a function that will identify and filter on a value in one field based on a parameter value which is based on a different field. The decode function works except when I need two results for the second field based on one {?parm}.

{?parm} Field2
7 233
8 134,135
9 436

Is it possible to use decode with two results, and if so, how would I go about it? I've tried, e.g.,

"table"."field2" =
decode({?parm},7,233,8,(134,135),9,436)

If this isn't possible, is there another function I could use? I haven't been able to get a "case when" to work either.

-LB
 
DDiamond

YOur code is so much neater than mine. Never thought of using decode that way. You learn something new every day.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top