DROP VIEW IF EXISTS v_asetinframap;
CREATE VIEW v_asetinframap AS
SELECT
	`asetmap`.`OGR_FID` AS `OGR_FID`,
	`asetmap`.`SHAPE` AS `SHAPE`,
	`asetmap`.`ket` AS `ket`,
	`aset`.`tipe` AS `tipe`,
	`aset`.`tahun` AS `tahun`,
	`aset`.`satminkal` AS `satminkal`,
	`aset`.`wilayah` AS `wilayah`,
	`aset`.`urutan` AS `urutan`,
	`aset`.`kode_satker` AS `kode_satker`,
	`aset`.`satker` AS `satker`,
	`aset`.`hak` AS `hak`,
	`aset`.`scan_sertifikat` AS `scan_sertifikat`,
	`aset`.`prop` AS `prop`,
	`aset`.`kab` AS `kab`,
	`aset`.`kec` AS `kec`,
	`aset`.`kel` AS `kel`,
	`aset`.`pervorasi` AS `pervorasi`,
	`aset`.`latitude` AS `latitude`,
	`aset`.`longitude` AS `longitude`,
	`aset`.`bpn_jenis` AS `bpn_jenis`,
	`aset`.`bpn_tanggal` AS `bpn_tanggal`,
	`aset`.`bpn_luas` AS `bpn_luas`,
	`aset`.`bpn_nib` AS `bpn_nib`,
	`aset`.`bpn_koordinat` AS `bpn_koordinat`,
	`aset`.`bpn_nomorbuku` AS `bpn_nomorbuku`,
	`aset`.`bpn_penguasaan` AS `bpn_penguasaan`,
	`aset`.`bpn_nomorsertifikat` AS `bpn_nomorsertifikat`,
	`aset`.`bpn_penerbit` AS `bpn_penerbit`,
	`aset`.`sk_tanggal` AS `sk_tanggal`,
	`aset`.`sk_nomor` AS `sk_nomor`,
	`aset`.`bpn_suratukur` AS `bpn_suratukur`,
	`aset`.`bpn_tglsuratukur` AS `bpn_tglsuratukur`,
	`aset`.`no_brankas` AS `no_brankas`,
	`aset`.`no_loker` AS `no_loker`,
	`aset`.`no_box` AS `no_box`,
	`aset`.`no_sertifikat` AS `no_sertifikat`,
	`aset`.`status_tusi` AS `status_tusi`,
	`aset`.`simak_golongan` AS `simak_golongan`,
	`aset`.`simak_bidang` AS `simak_bidang`,
	`aset`.`simak_kelompok` AS `simak_kelompok`,
	`aset`.`simak_subkelompok` AS `simak_subkelompok`,
	`aset`.`simak_namabmn` AS `simak_namabmn`,
	`aset`.`keterangan` AS `keterangan`,
	`aset`.`daerah_irigasi` AS `daerah_irigasi` 
FROM
	(
	`asetmap`
	-- kombinasi aset BPN dengan peta, dengan acuan 5 digit NIB
	-- LEFT JOIN `aset` ON ( RIGHT ( `aset`.`bpn_nib`, 5 ) = `asetmap`.`ket` )) 
	-- kombinasi aset BPN dengan peta, dengan acuan nomorbuku
	LEFT JOIN `aset` ON ( `aset`.`bpn_nomorbuku` = `asetmap`.`nomorbuku` ));