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
 Help Please SQL Enterprise Manager.

Author  Topic 

shurl
Starting Member

2 Posts

Posted - 2006-09-15 : 03:54:27
Hi all, I am not over familiar with SQL, I am a VB Programmer, however I need to achieve the following.

In Enterprise Manager I have 2 tables A and B.

I need to get a column from A and then scan the entire contents of B to see whether the content, the value from the column in A actually exists in B. The get the next value from A and repeat the process.


Any Help Would be appreciated.


Many Thanks

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-09-15 : 04:01:58
I am not very clear about your requirement!!

When you say:

quote:
I need to get a column from A and then scan the entire contents of B to see...


Do you mean you want to scan value of column from table A into every column value of table B? or into some specific column from table B?

Anyway, I assume second condition and here is the query:

Select Col1 from A where exists (select * from B where B.Col = A.Col1)


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-15 : 04:02:33
to list rows from A that not exists in B
select A.*
from A left join B
A.col = B.col
where B.col is null

to list rows from A that exists in B
select A.*
from A inner join B
A.col = B.col



KH

Go to Top of Page

shurl
Starting Member

2 Posts

Posted - 2006-09-15 : 07:10:12
Thanks to you all, I have managed to achieve my goal with your help of course, greatly appreciated, thanks to all of you again.

Go to Top of Page
   

- Advertisement -