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 2000 Forums
 SQL Server Development (2000)
 WEIRD Results with DB. PLease help me...

Author  Topic 

jesus4u
Posting Yak Master

204 Posts

Posted - 2001-12-18 : 10:43:42
ok here is the scoop

Look at this link

[url]http://4rates.net/code/db1.jpg[/url]

In the top table, as you can see I have 2 unique CJQID's for the ResponseID 47.
The table below is joined by the ResponseID.

Now look at this link

[url]http://4rates.net/code/db2.jpg[/url]

My query is trying to bring back the unique response for CJQID = 5 for the particular section 7.

PLEASE LOOK AT THE RESULTS OF THE QUERY! Why in the world am I getting back a record for the CJQID = 31? Look at the first record. It is the data from CJQID = 31! That is not in my WHERE clause?

Thanks

Nazim
A custom title

1408 Posts

Posted - 2001-12-18 : 10:57:11
i tried following ur links, its pretty confusing , it will be better if u just write ur query and sample data here in the forum, it will b pretty easy to follow.



-------------------------
"Success is when Preparedness meets Opportunity"
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2001-12-18 : 10:59:52
You're joining the Response and OtherResponse tables on ResponseID, not ResponseID and CJQID. Any match for ResponseID, regardless of CJQID, will be returned unless you further filter or join the Response tables.

Go to Top of Page

jesus4u
Posting Yak Master

204 Posts

Posted - 2001-12-18 : 11:13:45
quote:

You're joining the Response and OtherResponse tables on ResponseID, not ResponseID and CJQID. Any match for ResponseID, regardless of CJQID, will be returned unless you further filter or join the Response tables.





YEs thanks that was it! I am so new to SQL queries like this :)

Go to Top of Page
   

- Advertisement -