Welcome to the POB User Group Online Community! › Forums › PUG DACH › SQL for Dummies – Dataload Customer bis Organization_Type › Reply To: SQL for Dummies – Dataload Customer bis Organization_Type
21/05/2015 at 10:37
#2807
Participant
Nein, ich meine es in etwa so:
SELECT cus.customer_pk as Kontakt
, org.id as Organisation
, ot.Organization_Type_PK as OTyp
, ot.id as OTypId
FROM Customer cus
INNER JOIN Organization org ON cus.organization_pk = org.organization_pk
INNER JOIN Organization_Type ot ON org.Organization_Type_PK = ot.Organization_Type_PK and ot.Id='Intern'
WHERE isnull(cus.Virtual_Bereichsleiterkennzeichen,0)=0
Mit den Tabellenkürzeln siehst du einfach besser durch.
Ich hab mal auf INNER JOIN umgestellt, dann ist es für dich vielleicht einfacher. Wenn du mit einem LEFT JOIN arbeitest, siehst du natürlich mehr Datensätze als gewünscht, du müsstest dann den WHERE-Bereich deutlich erweitern. Siehe es jetzt besser aus?
-
This reply was modified 5 years, 8 months ago by
Stefan Reichelt.