SELECT DISTINCT PUB_p_partner.p_partner_key_n AS PartnerKey, PUB_p_partner.p_partner_short_name_c AS ShortName, PUB_p_partner.p_partner_class_c AS PartnerClass, loc.*, PartnerAttributePhone.p_value_c AS Phone, PartnerAttributeMobile.p_value_c AS Mobile, PartnerAttributeEMail.p_value_c AS EMail FROM PUB_p_partner_location pl, PUB_p_location loc, PUB_p_partner_type as ptype, PUB_p_partner LEFT JOIN PUB_p_partner_attribute AS PartnerAttributePhone ON PartnerAttributePhone.p_partner_key_n = PUB_p_partner.p_partner_key_n AND PartnerAttributePhone.p_attribute_type_c = 'Phone' LEFT JOIN PUB_p_partner_attribute AS PartnerAttributeMobile ON PartnerAttributeMobile.p_partner_key_n = PUB_p_partner.p_partner_key_n AND PartnerAttributeMobile.p_attribute_type_c = 'Mobile Phone' LEFT JOIN PUB_p_partner_attribute AS PartnerAttributeEMail ON PartnerAttributeEMail.p_partner_key_n = PUB_p_partner.p_partner_key_n AND PartnerAttributeEMail.p_attribute_type_c = 'E-Mail' WHERE ptype.p_partner_key_n = PUB_p_partner.p_partner_key_n AND NOT PUB_p_partner.p_partner_key_n = 0 AND pl.p_partner_key_n = pub_p_partner.p_partner_key_n AND pl.p_location_key_i = loc.p_location_key_i AND pl.p_site_key_n = loc.p_site_key_n #if {param_exclude_specialtypes} AND NOT {LISTCMP param_exclude_specialtypes ptype.p_type_code_c} #endif #if {param_explicit_specialtypes} AND {LISTCMP param_explicit_specialtypes ptype.p_type_code_c} #endif #if {param_active} AND PUB_p_partner.p_status_code_c = 'ACTIVE' #endif #if {param_families_only} AND PUB_p_partner.p_partner_class_c LIKE 'FAMILY%' #endif #if {param_excludeNoSolicitations} AND NOT PUB_p_partner.p_no_solicitations_l #endif #if {param_only_addresses_valid_on} AND pl.p_send_mail_l = true AND ({param_today} >= pl.p_date_effective_d OR pl.p_date_effective_d IS NULL) AND ({param_today} <= pl.p_date_good_until_d OR pl.p_date_good_until_d IS NULL) #endif #if {param_city} AND LOWER(loc.p_city_c) = LOWER({param_city}) #endif #if {param_country} AND {LISTCMP param_country loc.p_country_code_c} #endif ORDER BY 1
Partner Key
Name
Street
Post Code
City
Country
Phone
Mobile
E-Mail

{PartnerKey}
{ShortName}
{p_street_name_c}
{p_postal_code_c}
{p_city_c}
{p_country_code_c}
{Phone}
{Mobile}
{EMail},