SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE view [dbo].[vw_tt_act_branches]
as

	select	br__br_currency_code = br_currency_code,
	
			br__act_actor_id = act_actor_id,
			br__act_internal_reference = act_internal_reference,
			br__act_external_reference = act_external_reference,
			br__act_address_id = act_address_id,
			
			br__adr_name = adr_name,
			br__adr_first_name = adr_first_name,
			br__adr_complete_name = adr_complete_name,
			br__adr_address1 = adr_address1,
			br__adr_address2 = adr_address2,
			br__adr_address3 = adr_address3,
			br__adr_postal_code = adr_postal_code,
			br__adr_city = adr_city,
			br__adr_country_code = adr_country_code,
			br__adr_mail = adr_mail,
			br__adr_home_phone = adr_home_phone,
			br__adr_business_phone = adr_business_phone,
			br__adr_business_phone2 = adr_business_phone2,
			br__adr_mobile_phone = adr_mobile_phone,
			br__adr_fax = adr_fax,
			br__adr_title_code = adr_title_code,
			
			br__nmtit_l1 = nmtit_l1,
			br__nmtit_l2 = nmtit_l2,
			br__nmtit_l3 = nmtit_l3,

			br__nmtit_short_code_l1 = nmtit_short_code_l1,
			br__nmtit_short_code_l2 = nmtit_short_code_l2,
			br__nmtit_short_code_l3 = nmtit_short_code_l3,
			
			br__nmctr_l1 = nmctr_l1,
			br__nmctr_l2 = nmctr_l2,
			br__nmctr_l3 = nmctr_l3,
			
			br__cur_l1 = cur_l1,
			br__cur_l2 = cur_l2,
			br__cur_l3 = cur_l3
	from act_branches
		inner join act_actors on act_actor_id = br_actor_id
		inner join vw_tt_act_actors_addresse_corresp on adra_actor_id = act_actor_id
		inner join adr_addresses on adr_address_id = adra_address_id 
		left join nm_titles on nmtit_title_code = adr_title_code
		left join nm_countries on nmctr_country_code = adr_country_code
		left join acc_currencies on cur_currency_code = br_currency_code


GO
