Join on two table based on condition

I have two tables


number type name
12 1 steve
12 2 smith
12 2 jack

and so on....

similiarly for


number type name
12 1 abraham
12 2 jack
12 2 smith

Here i am doing inner join and i need output as where there is mismatch in name when number and type is equal. My query is

select * from table1,table2 
where table1.number=table2.number and table1.type=table2.type and <> 

But the output shows for type '2' smith jack and jack smith as well which i dont want.can anyone help me?

Read more here:

Content Attribution

This content was originally published by pavan sai at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: