SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure [dbo].[p_policy_product_variables_companies_params]
	@product_code ais_code_short
as

	/*
	select c.*
	from vw_act_cies c
		inner join (
					select distinct prdv_company_id 
					from pr_products_variables 
					where		prdv_product_code = @product_code
							and prdv_company_id is not null 
					) as t on c.cie_actor_id = prdv_company_id
	*/
	
	
	-- cred ca e mai rapida varianta asta, chiar daca returneaza mai multe valori
	/*
	select c.*
	from vw_act_cies c
		inner join pr_compagnies on cie_actor_id = prcie_compagnie_id
	where prcie_product_code = @product_code
	*/
	
	select c.*
	from vw_act_cies c
		inner join pr_families_cies on cie_actor_id = prfc_company_id
		inner join pr_products on prfc_family_code = prd_family_code  
	where prd_product_code = @product_code
		
	
GO
