View previous topic :: View next topic
|
Author |
Message |
Soundararajan
New User
Joined: 07 Jan 2007 Posts: 13 Location: INDIA
|
|
|
|
Hi,
I have a table structure as below:
C_CODE, P_61, P_62, P_63
I want to fetch C_CODE column value.
For example, If input value contains 61 then I have to use P_61 column and I have to fetch appropriate C_CODE column value. If input value contains 62 then I have to use P_62 column and I have to fetch appropriate C_CODE column value and so on. Please help me to write the above mentioned scenario in a single query.
Thanks in advance. |
|
Back to top |
|
|
Srihari Gonugunta
Active User
Joined: 14 Sep 2007 Posts: 295 Location: Singapore
|
|
|
|
What do the columns P_61, P_62, P_63 contain?
Just wanted to know how you want the query when your input is 61. |
|
Back to top |
|
|
Soundararajan
New User
Joined: 07 Jan 2007 Posts: 13 Location: INDIA
|
|
|
|
P_61, P_62, P_63 contains X.
Thanks,
Soundar. |
|
Back to top |
|
|
Soundararajan
New User
Joined: 07 Jan 2007 Posts: 13 Location: INDIA
|
|
|
|
If my input is 61, I have to check whether P_61 contains X or not, If my input is 62 I have to check whether P_62 contains X or not and so on..and I have to retrieve C_CODE value also.
Thanks,
Soundar. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Try this
Code: |
when (:input = '61' and p_61 = 'X')
or (:input = '62' and p_62 = 'X') |
|
|
Back to top |
|
|
|