Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: help with a simple query
select a.*
from a
where a.col1=val1
union
select a.*
from a, b
where a.col1 is null and
b.col1=val1and a.col2 = b.col2
gsa_at_baltros.ru
<javadrink_at_my-deja.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:91m21a$fa9$1_at_nnrp1.deja.com...
> I need to do a following query (using table a, b):
>
>
> select *
> from a
> where a.col1=val1 or if a.col1=null then b.col1=val1
> wherea.col2 = b.col2
>
> how to express the if part using SQL? thanks a lot!
>
> (basically what I want to do is: selection based tableA column1, but if
> tableA column1 is null, join tableA with tableB using column2 and make
> sure tableB column 1 equal to the input value)
>
> Thanks!
>
>
> Sent via Deja.com
> http://www.deja.com/
Received on Tue Dec 19 2000 - 07:42:23 CST
![]() |
![]() |