Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Like clause queries

Re: Like clause queries

From: Sam <samevan_at_hotmail.com>
Date: 17 Jan 2003 15:01:03 -0800
Message-ID: <35a7dd54.0301171501.6eb157d@posting.google.com>


Pablo Sanchez <pablo_at_dev.null> wrote in message news:<Xns9306845F863A2pingottpingottbah_at_216.166.71.233>...
> DA Morgan <damorgan_at_exesolutions.com> wrote in
> 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.
>
> Unless Sam wants to dummy up query numero uno to return the same
> number of columns as query number two:
>
> select T1_Field1, NULL, NULL ...
>
> UNION ...
>
> select * from T2
>
> This means that the type of the first column in the second select
> needs to be the same type ... err, ya know what, this just 'feels'
> wrong. Are the two queries related? If they are, you can go with
> what I'm suggestioning. Also, for safety sake, I'd not use '*', I'd
> enumerate all the columns. Of course the latter will break if the
> table is modified so perhaps using '*' is fine. :)

Can not use UNION! Because the 2nd query uses the first query result as a filter. Received on Fri Jan 17 2003 - 17:01:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US