how we get comman record from the two table through sql

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

like union i need intersect which give me the comman records from two table
i have two table having comman field but the number of record is different
and may have different in number then i need the comman record in table one
on the basis of second table
 
When creating a query and selecting both tables, you need to link the fields
that are common (link) the two tables.
The link between the two tables need to be Inner Join (have a look at this
link to see the different between each join)
http://www.databasedev.co.uk/query_joins.html

The inner join will display all the records that are common for both tables

In SQL
Select TableName.* From TableName Inner Join TableName2 ON
TableName.FieldName = TableName2.FieldName
 
Thanks for the reply
but
u know that this join take lot of time and memory.
but in our application we r working on reducing time n memory.
i know this "you replied" but i want the alernative like oracle it has
command like "intersect" actually join multiplied the records and then filter
it, it take lot of time
plz reply the alternative.
again tnx
 
A group by query will remove the duplicates from the query

Another option will be, using In as a filter

Select TableName.* From TableNAme Where FieldName In (Select FieldNAme From
TableNAme2)

Not, sure if it will be quicker, but try it
 
Tnx
"Ofer Cohen"
this will may work fine
but i am sure it will work faster then the previous one
i will impliment and then i will responde u back the output
tnx
like u i will also try to help others.
tnx
"Sumit"
 
Back
Top