SELECT * FROM dbo.web_spaj WHERE id_unit_pelayanan_create='0009' AND create_date>='2013-11-01' AND submitted_date<'2014-04-01' AND submitted=1 ORDER BY submitted_date --83
SELECT
  s.no_spaj, 
  p.nama_lengkap AS 'nama_pemegang',
  t.nama_lengkap AS 'nama_tertanggung',
  '[' + s.id_plan_dasar + '] ' + pa.deskripsi AS 'plan_dasar',
  s.masa_kontrak_dasar, 
  s.uang_pertanggungan_dasar, 
  pb.deskripsi AS 'periode_bayar',
  s.catatan, 
  s.tgl_aplikasi, 
  s.tgl_mulai, 
  s.tgl_produksi, 
  --s.id_unit_pelayanan_produksi, 
  upp.deskripsi AS unit_pelayanan_produksi,
  --s.id_unit_pelayanan_korespondensi, 
  upk.deskripsi AS unit_pelayanan_korespondensi, 
  s.id_agen, 
  a.nama_agen,
  --s.id_cabang, 
  c.nama_cabang,
  s.create_date, 
  usc.Nama AS create_by,
  s.submitted_date, 
  uss.Nama AS submitted_by, 
  --s.id_unit_pelayanan_create,
  upc.deskripsi AS unit_pelayanan_create
FROM 
  dbo.web_spaj s INNER JOIN
  dbo.web_spaj_pemegang p ON s.no_spaj=p.no_spaj INNER JOIN
  dbo.web_spaj_tertanggung t ON s.no_spaj=t.no_spaj INNER JOIN
  IndInsurance.dbo.plan_asuransi pa ON s.id_plan_dasar=pa.id_plan INNER JOIN
  IndInsurance.dbo.periode_bayar pb ON s.id_periode_bayar=pb.id_periode_bayar INNER JOIN
  IndInsurance.dbo.agen a ON s.id_agen=a.id_agen INNER JOIN
  IndInsurance.dbo.cabang c ON s.id_cabang=c.id_cabang INNER JOIN
  IndInsurance.dbo.unit_pelayanan upp ON s.id_unit_pelayanan_produksi=upp.id_unit_pelayanan INNER JOIN
  IndInsurance.dbo.unit_pelayanan upk ON s.id_unit_pelayanan_korespondensi=upk.id_unit_pelayanan INNER JOIN
  IndInsurance.dbo.unit_pelayanan upc ON s.id_unit_pelayanan_create=upc.id_unit_pelayanan INNER JOIN
  IndInsurance.dbo.gUser_Name usc ON s.create_by=usc.Id_User INNER JOIN
  IndInsurance.dbo.gUser_Name uss ON s.submitted_by=uss.Id_User
WHERE 
  s.id_unit_pelayanan_create='0009' 
  AND s.create_date>='2013-11-01' AND s.submitted_date<'2014-04-01' 
  AND s.submitted=1 
ORDER BY s.submitted_date

SELECT TOP 10 * FROM IndInsurance.dbo.gUser_Name

SELECT * FROM dbo.web_spaj WHERE id_unit_pelayanan_create='0009' AND id_unit_pelayanan_create<>id_unit_pelayanan_produksi
SELECT * FROM dbo.web_spaj_dokumen WHERE