Connecting Tech Pros Worldwide Help | Site Map

Uncommon records from two table

Newbie
 
Join Date: Jul 2008
Posts: 2
#1: Aug 1 '08
HI,

I have two tables.I want to retrieve the uncommon records from two tables.

I m using the queries :

select col1,col2 from table 1
where rtrim(col1+'-'+col2) not in
(select rtrim(col1+'-'+col2) from table 2)

i have used this query also :

select rtrim(col1+'-'+col2+'-'+col3+'-'+col4) from table 1
except
select rtrim(col1+'-'+col2+'-'+col3+'-'+col4) from table 2


The problem is that these two queries are taking huge time for execution.

First table has around 1 lakh records
and the second one is havoin 10.000 records.

Logically,i knw it would take time but is n't there ny another alternative for this ?

thanks
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,504
#2: Aug 1 '08

re: Uncommon records from two table


What exactly you mean by uncommon records
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,925
#3: Aug 1 '08

re: Uncommon records from two table


Are you talking about this ?

-- CK
Reply


Similar Microsoft SQL Server bytes