Link to home
Start Free TrialLog in
Avatar of dibanezb
dibanezb

asked on

Query with condition using like and subquery

Suppose I have a table (table1) with:
data1   data2
ABC     11
ADF      45
BBC      24
CCD      33
CCG      67

Another table (table2) has:
data3    data4
A           xx
C           yy

I need a query that gives me as result:
data1   data2
ABC     11
ADF      45
CCD      33
CCG      67

I have tried some combination of:
select data1, data2 from table1 where data1 like '%' + (select data3 from table2)
but It gives me an error.

Do you have any suggestion for it?
Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of simonpaul64
simonpaul64

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dibanezb
dibanezb

ASKER

Thanks for your answer.
Have a merry christmas.