Tuesday, June 7, 2016

The Relation between Party Sites, Party site uses and Party Locations

/* Formatted on 2016/06/07 23:27 (Formatter Plus v4.8.8) */
SELECT a.party_id, a.party_site_id, a.location_id, a.last_update_date,
       a.party_site_number, a.last_updated_by, a.creation_date, a.created_by,
       a.last_update_login, a.request_id, a.program_application_id,
       a.program_id, a.program_update_date, a.wh_update_date,
       a.attribute_category, a.attribute1, a.attribute5, a.attribute2,
       a.attribute3, a.attribute4, a.attribute6, a.attribute7, a.attribute8,
       a.attribute9, a.attribute10, a.attribute11, a.attribute12,

       a.attribute13, a.attribute14, a.attribute15, a.attribute16,
       a.attribute17, a.attribute18, a.attribute19, a.attribute20,
       a.global_attribute_category, a.global_attribute1, a.global_attribute2,
       a.global_attribute3, a.global_attribute4, a.global_attribute5,
       a.global_attribute6, a.global_attribute7, a.global_attribute8,
       a.global_attribute9, a.global_attribute10, a.global_attribute11,
       a.global_attribute12, a.global_attribute13, a.global_attribute14,
       a.global_attribute15, a.global_attribute16, a.global_attribute17,
       a.global_attribute18, a.global_attribute19, a.global_attribute20,
       a.orig_system_reference, a.start_date_active, a.end_date_active,
       a.region, a.mailstop, a.customer_key_osm, a.phone_key_osm,
       a.contact_key_osm, a.identifying_address_flag, a.LANGUAGE, a.status,
       a.party_site_name, b.site_use_type, b.primary_per_type, b.comments,
       b.party_site_use_id, c.country, c.address1, c.address2, c.address3,
       c.address4, c.city, c.postal_code, c.state, c.province, c.county,
       c.address_key, c.address_style, c.validated_flag,
       c.address_lines_phonetic, c.apartment_flag, c.po_box_number,
       c.house_number, c.street_suffix, c.apartment_number,
       c.secondary_suffix_element, c.street, c.rural_route_type,
       c.rural_route_number, c.street_number, c.building, c.FLOOR, c.suite,
       c.room, c.postal_plus4_code, c.TIME_ZONE, c.overseas_address_flag,
       c.post_office, c.POSITION, c.delivery_point_code,
       c.location_directions, c.address_effective_date,
       c.address_expiration_date, c.address_error_code, c.clli_code, c.dodaac,
       c.trailing_directory_code, c.life_cycle_status, c.short_description,
       c.description, c.content_source_type, c.loc_hierarchy_id,
       c.sales_tax_geocode, c.sales_tax_inside_city_limits, c.fa_location_id
  FROM hz_party_sites a, hz_party_site_uses b, hz_locations c
 WHERE a.location_id = c.location_id AND a.party_site_id = b.party_site_id(+)