SELECT
	prs.Nama_Perusahaan,
	pa.No_Polis,
	pa.Tgl_Mulai,
	pa.Tgl_Selesai,
	lp.data AS Produk
FROM
	dbo.Polis_Asuransi AS pa INNER JOIN
	dbo.Perusahaan AS prs ON pa.No_Prs = prs.No_Prs LEFT JOIN
	(
	  SELECT
	  	pa2.No_Proposal
	  FROM
	  	dbo.Polis_Asuransi AS pa2 INNER JOIN
	  	dbo.Produk_Polis AS pp ON pa2.No_Proposal = pp.No_Proposal
	  WHERE
	    pa2.Status = 'I'
	    AND pp.Status = 'I'
	    AND pp.Kelompok = '03'
	) AS askes ON pa.No_Proposal = askes.No_Proposal
	CROSS APPLY dbo.func_list_produk(pa.No_Proposal) AS lp
WHERE
  pa.Status = 'I'
  AND askes.No_Proposal IS NULL
ORDER BY
  prs.Nama_Perusahaan



SELECT
	sk.Field_Name
FROM
	dbo.Produk_Polis AS pp INNER JOIN
	dbo.Sub_Kelompok AS sk ON pp.Sub_Kelompok = sk.Sub_Kelompok
WHERE
  pp.Status = 'I'
  AND pp.No_Proposal = 

SELECT
	*
FROM
	dbo.Produk_Polis
WHERE
  Create_Date >= '2017-01-01'