About
Pricing
Community
Teams
Start Free Trial
Log in
mahjag
asked on
3/16/2012
combine 2 column values in oracle so that the combined value can be used in an IN clause
Hi
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')
Oracle Database
5
1
Last Comment
mahjag
8/22/2022 - Mon
Sean Stuber
3/16/2012
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)
3/16/2012
Is this not a duplicate of your other question?
https://www.experts-exchange.com/questions/27635919/dealing-with-connect-by-queries.html
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);
ASKER CERTIFIED SOLUTION
Muhammad Ahmad Imran
3/17/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
awking00
3/17/2012
select b.* from tableA a, tableB b
where b.value = a.cust_id
or b.value = a.cust_zone;
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
mahjag
3/17/2012
ASKER
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,
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