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: Pablo Sanchez <pablo_at_dev.null>
Date: Fri, 17 Jan 2003 14:00:46 -0600
Message-ID: <Xns9306845F863A2pingottpingottbah@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. :)

-- 
Pablo Sanchez, High-Performance Database Engineering
http://www.hpdbe.com
Received on Fri Jan 17 2003 - 14:00:46 CST

Original text of this message

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