Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Comparing values

Author  Topic 

unikoman
Starting Member

32 Posts

Posted - 2006-02-23 : 20:46:04
Hi All

I have 2 tables
dbo.aus

dbo.us

aus has column ausid

us has column usersid

how do i ran a query to filter out all matching values in the 2 tables
basically i want a list of values that are the same in both tables

thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-23 : 20:48:13
a simple INNER JOIN will do the job

select *
from dbo.aus a inner join dbo.us u
on a.ausid = u.userid


----------------------------------
'KH'

It is inevitable
Go to Top of Page

unikoman
Starting Member

32 Posts

Posted - 2006-02-23 : 20:48:39
thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-24 : 01:24:32
Also read about joins-SQL Server in SQL Server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -