Re: Hi! All
Date: Wed, 5 Jul 2006 10:44:53 +0200
Message-ID: <e8fu87$ruj$1_at_ss408.t-com.hr>
"DA Morgan" <damorgan_at_psoug.org> wrote in message
news:1152027738.776684_at_bubbleator.drizzle.com
> Marino Ljubic wrote:
>>
>> There are several SQL queries that can achieve the result, 3 as I
>> can think of at this moment. What's the point? Exercise?
>
> Whatever. Here are the first 3 that popped into my head.
>
...
Since you provided the most logical answers, I can only give a few more complex for statistics...
select col1, max(tab) tab
from
(
select col1, 'T1' tab from t1
union all
select col1, 'T2' from t2
)
group by col1
having count(*) = 1
select col1, tab from (
select col1, tab, count(*) over (partition by col1) num
from
(
select col1, 'T1' tab from t1
union all
select col1, 'T2' from t2
)
)
where
num = 1
select r.col1, r.tab from
(
select col1, 'T1' tab from t1
union all
select col1, 'T2' from t2
) r,
(
select col1 from
(
select col1, 'T1' tab from t1
union all
select col1, 'T2' from t2
)
group by col1
having count(*) = 1
) c
where r.col1 = c.col1
I'm sure there's more, but my playtime is up... :-) Received on Wed Jul 05 2006 - 10:44:53 CEST