Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Like clause queries
DA Morgan <damorgan_at_exesolutions.com> wrote in message news:<3E284FEB.A787B50E_at_exesolutions.com>...
> Sam wrote:
>
> > I have two queries
> >
> > select T1_Field1 from T1 where T1_Field2 like "deptname"
> >
> > select * from T2 where T2_Field2 like T1_Field1
> >
> > Is there anyway to combine these two queries to one?
>
> No.
>
> One query selects a single field. The other, I presume, multiple fields.
>
> If the fields were the same in terms of datatype and number you could
> use UNION or UNION ALL
>
> But with respect to your first query you can do:
> LIKE "deptname"
>
> It is either
> = 'deptname'
> or it is
> LIKE '%deptname%'
>
> Daniel Morgan
You are right, it should use LIKE '%deptname%' If there is no way to combone these two queries into one. Can we write this two queries in a stored procedure? Received on Fri Jan 17 2003 - 16:57:54 CST
![]() |
![]() |