SELECT ks.id,
          b.borid,
          ks.indtag_nr,
          ks.indtagsid,
          b.aktiv_indvinding_jn,
          bb.dgunr dgu_nr,
          ml.kode mc_kode,
          ml.lang_tekst mc_navn,
          rl.kode region_kode,
          rl.lang_tekst region_navn,
          fl.lang_tekst boringsformaal,
          al.lang_tekst boringsanvendelse,
          CAST (ks.indtag_top_dybde AS NUMBER (7, 2)) indtag_top_dybde,
          CAST (ks.indtag_bund_dybde AS NUMBER (7, 2)) indtag_bund_dybde,
          ks.proeve_top,
          ks.proeve_bund,
          ks.proeveid,
          TO_CHAR (ks.dato, 'YYYY-MM-DD') proevedato,
          CAST (ks.calcium_1551 AS NUMBER (13, 3)) calcium_1551,
          CAST (ks.jern_2041 AS NUMBER (13, 3)) jern_2041,
          CAST (ks.kalium_2056 AS NUMBER (13, 3)) kalium_2056,
          CAST (ks.magnesium_2081 AS NUMBER (13, 3)) magnesium_2081,
          CAST (ks.mangan_2086 AS NUMBER (13, 3)) mangan_2086,
          CAST (ks.natrium_2096 AS NUMBER (13, 3)) natrium_2096,
          CAST (ks.chlorid_1591 AS NUMBER (13, 3)) chlorid_1591,
          CAST (ks.fluorid_2022 AS NUMBER (13, 3)) fluorid_2022,
          CAST (ks.hydrgcarb_305 AS NUMBER (13, 3)) hydrgcarb_305,
          CAST (ks.ilt_251 AS NUMBER (13, 3)) ilt_251,
          CAST (ks.nitrat_1176 AS NUMBER (13, 3)) nitrat_1176,
          CAST (ks.sulfat_2142 AS NUMBER (13, 3)) sulfat_2142,
          CAST (ks.kationsumberegnet AS NUMBER (13, 3)) kationsumberegnet,
          CAST (ks.anionsumberegnet AS NUMBER (13, 3)) anionsumberegnet,
          CAST (ks.ionbalance AS NUMBER (13, 3)) ionbalance,
          CAST (ks.antal_anioner AS NUMBER (13, 3)) antal_anioner,
          CAST (ks.antal_kationer AS NUMBER (13, 3)) antal_kationer,
          CAST (ks.konduktivitet_11 AS NUMBER (13, 3)) konduktivitet_11,
          vt.vandtype,
          CAST (ks.akvitard_over_indtag_m AS NUMBER (13, 3))
             akvitard_over_indtag_m,
          CAST (ks.magasin_over_indtag_m AS NUMBER (13, 3))
             magasin_over_indtag_m,
          CAST (ks.ukendt_over_indtag_m AS NUMBER (13, 3))
             ukendt_over_indtag_m,
          ks.indtags_bjergart,
          b.hoved_vandopland,
          b.sloejfet_jn,
          'http://data.geus.dk/JupiterWWW/borerapport.jsp?borid=' || b.borid
             url_borerapport,
          bb.zdvr90 terraen_kote,
          bb.boringsdybde,
          bb.xutm32euref89,
          bb.yutm32euref89,
          TO_CHAR (b.udtraeksdato, 'YYYY-MM-DD') udtraeksdato,
          bs.punkt_utm32 geom,
          vt.cache_date
     FROM mcportal.mc_boring b
          INNER JOIN bor$boring$v bb
             ON bb.borid = b.borid                          -- fortrolig='nej'
          INNER JOIN bor$boring_spatial bs
             ON bs.borid = b.borid
          LEFT OUTER JOIN gen$miljoecenter_liste ml
             ON ml.kode = bb.miljoecenter
          LEFT OUTER JOIN gen$region_liste rl
             ON rl.kode = bb.region
          LEFT OUTER JOIN bor$formaal_liste fl
             ON fl.kode = bb.formaal
          LEFT OUTER JOIN bor$anvend_liste al
             ON al.kode = bb.anvendelse
          INNER JOIN mcportal.mc_kvalitetssikring ks
             ON b.borid = ks.borid
          LEFT OUTER JOIN mcportal.mc_vandtype vt
             ON ks.proeveid = vt.proeveid;