-- ITBBU
select updated_date
     , moc

     , managedelement ->> 'managedElementType'   as managedElementType
     , managedelement ->> 'moId'                 as managedElement
     , cleansing(managedelement ->> 'userLabel') as ne_name
     , ldn                                       as ldn

     , parameters ->> 'moId'                     as moId
     , cleansing(parameters ->> 'userLabel')     as userLabel
     , cleansing(parameters ->> 'alias')         as alias
     , parameters ->> 'cellLocalId'              as cellLocalId
     , parameters ->> 'tac'                      as tac
     , parameters ->> 'simuLoadSwchDl'           as simuLoadSwchDl
     , parameters ->> 'altitude'                 as altitude

--      , managedelement
--      , parameters
from dump
where moc = 'CUEUtranCellFDDLTE'
  and left(cleansing(managedelement ->> 'userLabel'), 6) = 'AGA002'
order by moc
limit 100
;


-- SDR
select updated_date
     , moc

     , managedelement ->> 'subType'              as managedElementType
     , managedelement ->> 'MEID'                 as managedElement
     , cleansing(managedelement ->> 'USERLABEL') as ne_name
     , ldn                                       as ldn

     , parameters ->> 'EUtranCellFDDId'          as moId
     , cleansing(parameters ->> 'userLabel')     as userLabel
     , cleansing(parameters ->> 'alias')         as alias
     , parameters ->> 'cellLocalId'              as cellLocalId
     , parameters ->> 'tac'                      as tac
     , parameters ->> 'simuLoadSwchDl'           as simuLoadSwchDl
     , parameters ->> 'altitude'                 as altitude

--      , managedelement
--      , parameters
from dump
where moc = 'EUtranCellFDD'
  and left(cleansing(managedelement ->> 'USERLABEL'), 6) = 'AMB002'
order by moc
limit 100
;


-- COMBINED ITBBU + SDR
select updated_date
     , moc

     , managedelement ->> 'managedElementType'   as managedElementType
     , managedelement ->> 'moId'                 as managedElement
     , cleansing(managedelement ->> 'userLabel') as ne_name
     , ldn                                       as ldn

     , parameters ->> 'moId'                     as moId
     , cleansing(parameters ->> 'userLabel')     as userLabel
     , cleansing(parameters ->> 'alias')         as alias
     , parameters ->> 'cellLocalId'              as cellLocalId
     , parameters ->> 'tac'                      as tac
     , parameters ->> 'simuLoadSwchDl'           as simuLoadSwchDl
     , parameters ->> 'altitude'                 as altitude

--      , managedelement
--      , parameters
from dump
where moc = 'CUEUtranCellFDDLTE'
  and left(cleansing(managedelement ->> 'userLabel'), 6) = 'AGA002'

union all

select updated_date
     , moc

     , managedelement ->> 'subType'              as managedElementType
     , managedelement ->> 'MEID'                 as managedElement
     , cleansing(managedelement ->> 'USERLABEL') as ne_name
     , ldn                                       as ldn

     , parameters ->> 'EUtranCellFDDId'          as moId
     , cleansing(parameters ->> 'userLabel')     as userLabel
     , cleansing(parameters ->> 'alias')         as alias
     , parameters ->> 'cellLocalId'              as cellLocalId
     , parameters ->> 'tac'                      as tac
     , parameters ->> 'simuLoadSwchDl'           as simuLoadSwchDl
     , parameters ->> 'altitude'                 as altitude

--      , managedelement
--      , parameters
from dump
where moc = 'EUtranCellFDD'
  and left(cleansing(managedelement ->> 'USERLABEL'), 6) = 'AMB002'
;