Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Combine Queries with LIKE Clause
DA Morgan <damorgan_at_exesolutions.com> wrote in message news:<3E298ACE.DC64C844_at_exesolutions.com>...
> Sam wrote:
>
> > I have two queries:
> >
> > select deptname from table1 (return 3 rows)
> >
> > select saleman from table2 where dept_desc LIKE '%table1.deptname%' (repeat 3 times)
> >
> > How to combine them together?
>
> Likely the problem is that you have created a Cartesian join. But without seeing your
> SQL it is impossible to know.
>
> Daniel Morgan
Thank you Daniel! Here are the queries and their results
1.
select deptname from table1 (return 3 rows)
returns three deptname
management
sale
engineer
2.
select saleman from table2 where dept_desc LIKE '%management%'
returns
Amy
Tony
note: table2 is directly converted from mainframe dept_desc field looks like "0056894_xxxx_management_line_435....."
select saleman from table2 where dept_desc LIKE '%sale%'
returns
Sreve
Tony
...
select saleman from table2 where dept_desc LIKE '%engineer%'
returns
David
...
Received on Sun Jan 19 2003 - 10:55:42 CST
![]() |
![]() |