compare value from two tables

hi how can i compare value from this two tables

i what to see emp1 accnumber value which is difiirent from accnumber emp2
something like this
select * from emp1
selet * from emp2
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

select accnumber from emp1
where accnumber not in (select accnumber from emp2)

Open in new window

slightwv (䄆 Netminder) Commented:
What are the primary keys of the tables?

You should be able to join the two tables on the primary keys and compare the two columns.
slightvw.. you highlight a key distinction... its not clear whether the comparison is to find things in emp1 not emp2 OR where the same "emp" entity has 2 different values in the two tables... something like...
select emp1.emp_id, emp1.accnumber, emp2.emp_id, emp2.accnumber 
from emp1
     inner join emp2 on emp1.emp_id = emp2.emp_id

Open in new window

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

chalie001Author Commented:
i what to display value like this
table emp1
table emp2
value i what to see
0992,twww,09222333,no2222,2010/09/09,ac0993,saving,  emp1 accn0 ac0993,emp2 accno acc09222
slightwv (䄆 Netminder) Commented:
Try the join example posted above.

What that won't show you is missing records from either table.
slightwv (䄆 Netminder) Commented:
chalie001Author Commented:
this is from same database and there is extra column diffirent_details after i return value from query to display the diffirent value
chalie001Author Commented:
and am comparing one column
slightwv (䄆 Netminder) Commented:
I do not understand that last post.

Was it an attempt to explain how this question is different from your previous question?

If so, I don't see the difference.  Two tables are two tables.  Same database or different doesn't matter.  It is still a join between them and comparing the columns.

Everything in the previous question concerning nulls still counts here.

I see this as the same question.

Please explain how it is different.
slightwv (䄆 Netminder) Commented:
>>and am comparing one column

Comparing one column or 1000 columns.  Do it the same way.
chalie001Author Commented:
i what something like this but with extra column diifirent_values

emp1 accn0 ac0993,emp2 accno acc09222

select * from emp1
where emp1.accnumber not in (select emp2.accnumber from emp2);

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Please give more test data (at least a few rows... 10 maybe), realistic data and give a proper example of the output you want. I don't think we are on the same page here. We have to setup a fiddle otherwise you're not going to get an answer here. What you just posted above cannot be achieved without a JOIN. So we keep going round in circles on the issue
In fact.. looking at your example output more closely... I cannot see what is wrong with the previous fiddle I gave you. Did you try the two variants of the query which I gave you?

Why do you want to have a different_values column in that format (on my versions, I just set it to 1 or 0 depending on whether there is a difference)? The way you want, just results in complex queries... which you also didnt want to have for all your columns.
chalie001Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.