Re: tubles matching - Mailing list pgsql-general

From Alban Hertroys
Subject Re: tubles matching
Date
Msg-id CAF-3MvOg9CfC8wurztATOW7VfbvMwMRxrDMVP9GCXnVp35mFDA@mail.gmail.com
Whole thread Raw
In response to tubles matching  (salah jubeh <s_jubeh@yahoo.com>)
Responses Re: tubles matching  (Chris Travers <chris.travers@gmail.com>)
List pgsql-general
On 28 September 2011 13:19, salah jubeh <s_jubeh@yahoo.com> wrote:
>
> Hello,
>
> I have two views both contain  identical column names , order and types
> except the primary keys. I want to match these two views - return the pk
> pair  of the rows which match from these views - by comparing all the column
> values. I want to write a pgplsql function to do this Job by iterating
> through all the coloumns and compare the values.
>
> Is there another way to do that ?

SELECT a.pk1, a.pk2 FROM view1 AS b INNER JOIN view2 AS b ON (a.pk1 =
b.pk1 AND a.pk2 = b.pk2 AND a.col1 = b.col1 AND a.col2=b.col2);

--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.

pgsql-general by date:

Previous
From: salah jubeh
Date:
Subject: tubles matching
Next
From: Siva Palanisamy
Date:
Subject: Help needed in Search