Feeds:
Posts
Comments

Posts Tagged ‘JOIN’

Now here is something that a programmer would have come across sometime or the other. Let us say you have a table where more than one columns make up the primary key and you need to find out all those rows which have two of these columns (attributes) same but the third attribute is different. You can do this using a simple join like this

SELECT * FROM Table1 A INNER JOIN Table1 B ON A.PK1=B.PK1 AND A.PK3=B.PK3 AND A.PK2 <> B.PK2

Advertisements

Read Full Post »