Tim Uckun <timuckun@gmail.com> wrote:=0A=0A>> how do you want to determine =
which of the matching rows in the=0A>> other table to choose, and which to =
ignore?=0A>=0A> Any of the matching rows will do but I just want one.=0A=0A=
Well, if you don't care, this might give you what you want.=0A=0Aselect dis=
tinct on (x.first6) crm.*, x.*=0A=A0 from from sap_crm_sales crm=0A=A0 join=
(select left(mc.sap_code,6) as first6, mc.*=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0 =
from model_configurations mc) x=0A=A0=A0=A0 on x.first6 =3D left(crm.custom=
er_class, 6)=0A=A0 order by x.first6;=0A=0AI can think of about a dozen dif=
ferent things which fit the=0Adescription that you've given so far that you=
*might* want instead,=0Abut unless you get more specific we can only guess=
.=0A=0AIf this isn't what you want, your best bet might might be to come=0A=
up with a self-contained example, where you create an populate=0Atables wit=
h a small amount of data, and show what you would like as=0Aa result given =
that data set.=0A=0A--=0AKevin Grittner=0AEnterpriseDB: http://www.enterpri=
sedb.com=0AThe Enterprise PostgreSQL Company