hi,

how to match retrieve the unmatched records from 2 tables
in which we dont have any primary key. example : table1 has
1,2,3,4,5 and table2 has 1,2,3,4,5,6,7,8,9,10 and i want
the numbers from 6 to 10 to be displayed and should not
come as null. i need the numbers. please reply as soon as
possible.

Answers were Sorted based on User's Feedback



hi, how to match retrieve the unmatched records from 2 tables in which we dont have any primary..

Answer / gangadhar

select * from table2 where id not in ( select id from
table1)

Is This Answer Correct ?    18 Yes 0 No

hi, how to match retrieve the unmatched records from 2 tables in which we dont have any primary..

Answer / debi

(select * from table2)
minus
(select * from table1)

Is This Answer Correct ?    6 Yes 6 No

hi, how to match retrieve the unmatched records from 2 tables in which we dont have any primary..

Answer / newbie

SELECT * from Table2
EXCEPT
SELECT * FROM Table1

Is This Answer Correct ?    1 Yes 1 No

hi, how to match retrieve the unmatched records from 2 tables in which we dont have any primary..

Answer / madhu sudhan g

Hiii

Its very simple to get the records that doesn't match lets
table1 is No1 and having A column values 1,2,3,4,5 and Table2
is No2 having column B values 1,2,3,4,5,6,7,8,9,10
Now Query is

select B from NO2 where B NOT IN(select A from NO1)

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What is difference between getdate and sysdatetime in sql server 2008?

0 Answers  


What are the Pre Requisites when you apply Srvice Packs?

1 Answers   IBM,


Is sql server implemented as a service or an application? : Sql server database administration

0 Answers  


What is a subquery in a select query statement in ms sql server?

0 Answers  


How to set database to be single_user in ms sql server?

0 Answers  






How to grant a permission in ms sql server using "grant execute" statements?

0 Answers  


What does truncate do?

0 Answers  


What are different types of constraints?

0 Answers  


List out some of the requirements to set up a sql server failover cluster?

0 Answers  


What are the advantages of stored procedure in sql server?

0 Answers  


What is the maximum rows in sql server table?

0 Answers  


What is the syntax for encrypting a column in SQL Server?

0 Answers   MindCracker,


Categories