Topics Topics Help/Instructions Help Edit Profile Profile Member List Register Paatha Gnyapakaalu - Archives from Old DB  
Search New Posts 1 | 2 | 8 Hours Search New Posts 1 | 3 | 7 Days Search Search Tree View Tree View Latest tweets Live Tweets   Hide Images

Rate this post by selecting a number. 1 is the worst and 5 is the best.

    (Worst)    1    2    3    4    5     (Best)

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Symbol_of_king
Kurra Bewarse
Username: Symbol_of_king

Post Number: 2119
Registered: 12-2005
Posted From: 72.209.237.32

Rating: N/A
Votes: 0

Posted on Wednesday, July 10, 2013 - 11:15 pm:   

with T1 as
(
select vendor_name, address_line1, vendor_id
from table a, b
where
..
Union
select vendor_name, address_line1, vendor_id
from table x, y
where
..
)

select vendor_name,address_line1,T1.vendor_id
from T1,
(select count(*) cnt,vendor_id from T1 where address_line1 is not null group by vendor_id) T2
where T1.vendor_id=T2.vendor_id(+) and

(T1.address_line1 is not null or (T2.cnt=0 and T1.address_line1 is null));

--I dont know if it is right or wrong... just tried to answer it :-)

Topics | Last Hour | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration