Zum Inhalt

Ansicht GroupMembers

Abfrage

SQL
  SELECT 
    GM."Mandant", GM."ID", GM."EnbreaID", 
    GM."Group", G."Code", G."Name",
    GM."MemberID", GM."MemberType", M."Vorname", M."Nachname", M."Strasse",
    M."Land", M."PLZ", M."Ort", M."Telefon", M."Email",
    GM."StartedAt", GM."FinishedAt", GM."Contribution", GM."ContributionPaidOn",
    GM."Function1", GM."Function2"
  FROM "tblGroupMembers" GM
  LEFT JOIN "Groups" G
  ON  G."Mandant" = GM."Mandant"
  AND G."ID" = GM."Group"
  LEFT JOIN "Personen" M
  ON  M."Mandant" = GM."Mandant"
  AND M."ID" = GM."MemberID"
  WHERE
    GM."MemberType" = 1
  UNION
  SELECT 
    GM."Mandant", GM."ID", GM."EnbreaID", 
    GM."Group", G."Code", G."Name",
    GM."MemberID", GM."MemberType", M."Vorname", M."Nachname", M."Strasse",
    M."Land", M."PLZ", M."Ort", M."Telefon", M."Email",
    GM."StartedAt", GM."FinishedAt", GM."Contribution", GM."ContributionPaidOn",
    GM."Function1", GM."Function2"
  FROM "tblGroupMembers" GM
  LEFT JOIN "Groups" G
  ON  G."Mandant" = GM."Mandant"
  AND G."ID" = GM."Group"
  LEFT JOIN "Lehrer" M
  ON  M."Mandant" = GM."Mandant"
  AND M."ID" = GM."MemberID"
  WHERE
    GM."MemberType" = 2  
  UNION
  SELECT 
    GM."Mandant", GM."ID", GM."EnbreaID", 
    GM."Group", G."Code", G."Name",
    GM."MemberID", GM."MemberType", M."Vorname", M."Nachname", M."Strasse",
    M."Land", M."PLZ", M."Ort", M."Telefon", M."EMail",
    GM."StartedAt", GM."FinishedAt", GM."Contribution", GM."ContributionPaidOn",
    GM."Function1", GM."Function2"
  FROM "tblGroupMembers" GM
  LEFT JOIN "Groups" G
  ON  G."Mandant" = GM."Mandant"
  AND G."ID" = GM."Group"
  LEFT JOIN "Schueler" M
  ON  M."Mandant" = GM."Mandant"
  AND M."ID" = GM."MemberID"
  WHERE
    GM."MemberType" = 3      
  UNION
  SELECT 
    GM."Mandant", GM."ID", GM."EnbreaID", 
    GM."Group", G."Code", G."Name",
    GM."MemberID", GM."MemberType", M."Vorname", M."Nachname", M."Strasse",
    M."Land", M."PLZ", M."Ort", M."TelefonPrivat", M."Email",
    GM."StartedAt", GM."FinishedAt", GM."Contribution", GM."ContributionPaidOn",
    GM."Function1", GM."Function2"
  FROM "tblGroupMembers" GM
  LEFT JOIN "Groups" G
  ON  G."Mandant" = GM."Mandant"
  AND G."ID" = GM."Group"
  LEFT JOIN "Sorgeberechtigte" M
  ON  M."Mandant" = GM."Mandant"
  AND M."ID" = GM."MemberID"
  WHERE
    GM."MemberType" = 4

Spalten

Diese Ansicht hat 22 Spalten.

Mandant

INTEGER

Verweis auf Tabelle Mandanten

ID

INTEGER

Mandantenbezogene, eindeutige ID

EnbreaID

VARCHAR(24)

Externer Identifikator aus ENBREA

Group

INTEGER

Verweis auf Tabelle Groups

GroupCode

VARCHAR(20)

GroupName

VARCHAR(300)

MemberID

INTEGER

MemberType

SMALLINT

MemberFirstname

VARCHAR(100)

MemberLastname

VARCHAR(100)

MemberStreet

VARCHAR(100)

MemberState

VARCHAR(3)

MemberZipCode

VARCHAR(10)

MemberCity

VARCHAR(100)

MemberPhone

VARCHAR(30)

MemberEmail

VARCHAR(100)

StartedAt

DATE

FinishedAt

DATE

Contribution

NUMERIC(?, 4)

ContributionPaidOn

DATE

Function1

VARCHAR(100)

Function2

VARCHAR(100)