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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Comparison Query

Author  Topic 

Iceberg00
Starting Member

1 Post

Posted - 2011-04-06 : 06:06:09
I've got the following data in two tables that i'm trying to compare:

1st table field contains data: 1,2,3,4,5

2nd table contains rows of:
1
2
3
4

Basically i need to say if one of the 2nd table appears in the 1st tables field then...

any ideas?



khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-04-06 : 06:09:54
then ... what ?

basically you can use EXISTS() to determine this


SELECT *
FROM table1 t1
WHERE EXISTS ( SELECT * from table2 t2 where t2.col = t1.col )





KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -