September 3, 2009 at 9:53 pm
check if any records match
if match ---rec match/not match
when used full outer join both tables
no name ph
1 X 0
2 Y 1
3 Z 2
4 A 3
no name ph
1 X 0
2 c 6
3 m 9
4 A 5
no name ph result
1 X 0 null--------------------------why im getting nul when there are records?
2 c 6 rec found
3 m 9 rec found
4 A 5 null------------------------why im getting nul when there are records?
5 Y 1 rec found
September 3, 2009 at 11:48 pm
Please post your exact query, and the actual data you are running.
(1) We need to know what columns you are joining ON. Row 1 in both tables is identical. There is no join on any combination of those columns that will produce the result you say you are getting.
(2) Where is No 5 coming from in your result? It doesn't exist in the sample data you just posted. Together with the impossible non-match for the first row, this leads me to believe you may not be actually joining the tables you think you are joining. Double check that first thing.
(3) Are you actually evaluating something to produce the string in your result column? If so, there may be something about that test which is in error. But until you show us your code we can't very well help you find the error.
If you want help, you should take the time to post your data, your code, and your results, or error, or desired results EXACTLY. If we can recreate your problem, we can resolve it. Being vague works against you getting a quick and correct answer. Go back over and do it again right, and someone will be able to assist you.
When you have time, read this article. [/url] Submitting your questions in this fashion will get you tested answers quicker and win you friends among the volunteers who take the time to help you out.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
September 6, 2009 at 12:23 pm
Sadly - as Bob stated - it's a bit difficult to help that way.
However, please try using CHECKSUM(*) or BINARY_CHECKSUM(*) to allow for single key comparison.
Note that there's a slight chance you'll be missing something, but it's a good function to start with
September 9, 2009 at 8:01 am
CHECKSUM(*) is a neat method to identify different records... thanks for the memory refresh 🙂
September 9, 2009 at 8:17 am
Also you can use INTERSECT and EXCEPT to find row matches
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply