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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Comparing one field that is in two tables
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ask SQLTeam Question

0 Posts

Posted - 03/05/2007 :  10:45:46  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
Ann writes "Ok, I wanted to test my SELECT stmt in SQL Query Analyzer before I put it in prodcution. I place a select stmt to compare the acctnum in one table with the acctnum in another table, but not all of the records come up. I did check the ones that didnt come up from the first file and they were in the second file but it didn't show up.

Is there something I am missing. Here is the code I am using:

select dbo.scrub_return.acctnum, dbo.scrub_return.found,
from dbo.scrub_return, dbo.bi_prescrub
where dbo.scrub_return.acctnum =
dbo.bi_prescrub.acctnum and found=' '"

Cybernetic Yak Master

11752 Posts

Posted - 03/05/2007 :  11:38:36  Show Profile  Visit spirit1's Homepage  Reply with Quote
you want to test it only in QA? That'll be stable

use join syntx.

well the way you have it written the returned records will be those that have the same
acctnum and dbo.scrub_return.found = ' '

is that what you want??

Causing trouble since 1980
Go to Top of Page

Starting Member

1 Posts

Posted - 03/05/2007 :  15:04:03  Show Profile  Send aboltz a Yahoo! Message  Reply with Quote
spirit 1: Yes, that is what I want. Whatever the acctnum is in scrub_return to find it in the bi_prescrub table. I have tried the join syntx but received the same number of acctnums returned.

Is there a way to put after dbo.scrub_return.acctnum or dbo.bi_prescrub, which would mean to get everything after in the acctnum field to make sure there is no ambigious characters or such.
Go to Top of Page

Starting Member

13 Posts

Posted - 03/06/2007 :  15:56:51  Show Profile  Reply with Quote
I'm having a hard time understanding what you want to accomplish. Can you try asking the question another way?

John Hopkins
Go to Top of Page

In (Som, Ni, Yak)

17689 Posts

Posted - 03/06/2007 :  16:52:39  Show Profile  Reply with Quote
try removing the found = '' clause ?

select dbo.scrub_return.acctnum, dbo.scrub_return.found,
from   dbo.scrub_return inner join dbo.bi_prescrub
on     dbo.scrub_return.acctnum = dbo.bi_prescrub.acctnum 
where  found =' '


Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000