Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Like clause queries
>>>>> "Sam" == Sam <samevan_at_hotmail.com> writes:
Sam> I have two queries select T1_Field1 from T1 where T1_Field2 like Sam> "deptname"
Sam> select * from T2 where T2_Field2 like T1_Field1
Sam> Is there anyway to combine these two queries to one?
Not sure exactly what you are after here. However, reading between the lines I'll have a couple of guesses.
T1.T1_field1, T2.T2_field1, ..., T2_fieldN
then what you MIGHT be after is just a join between the two tables based on T2.Field2 and T1.Field1
select T1.T1_field1, T2.T2_Field1, .., T2.T2_FieldN
from T1, T2
where T2.T2_Field2 = T1.T1_Field1
and T1.T1_Field2 = 'depname';
If you have NULLs in either of your joining fields, you may need to look into how to do an outer join.
Tim
-- Tim Cross The e-mail address on this message is FALSE (obviously!). My real e-mail is to a company in Australia called rapttech and my login is tcross - if you really need to send mail, you should be able to work it out!Received on Fri Jan 17 2003 - 15:49:59 CST
![]() |
![]() |