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.
| Author |
Topic |
|
jesus4u
Posting Yak Master
204 Posts |
Posted - 2001-12-18 : 10:43:42
|
| ok here is the scoopLook 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" |
 |
|
|
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. |
 |
|
|
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 :) |
 |
|
|
|
|
|