combine 2 column values in oracle so that the combined value can be used in an IN clause


I want to combine 2 column values in oracle and then use that combined value in the IN clause in the second query - how do I do that

Table A - 2 columns - cust_id, cust_zone - values - cust01, PRE - combined value 'custo01','PRE'

Second query

select * from table B where value in ('cust01','PRE')
Who is Participating?
Muhammad Ahmad ImranConnect With a Mentor Database DeveloperCommented:
and if assumed the two tables have some column relation

select * from tableB
where custid in (select custid from tableA) and cust_zone in (select cust_zone from tableA)
I'm not sure what you're asking,

I think "maybe" you're trying to do this...

select  * from tableB where value in (select cust_zone from tableA)

If that isn't correct please post sample data and expected results.
 not descriptive words, data that I can test with and replicate results
slightwv (䄆 Netminder) Commented:
Is this not a duplicate of your other question?

You cannot without dynamic SQL.

Off the top of my head:

select * from tableB where value in (select cust_id from tableA union select cust_zone from tableA);
select b.* from tableA a, tableB b
where b.value = a.cust_id
   or b.value = a.cust_zone;
mahjagAuthor Commented:
Hi Slightwv

It is not the same as previous question - I do want to get 2 column value as 1 so that i can use the value in a second query that has IN Clause

Please let me know,
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.