I am currently using the query below to pull data from two tables and multiple fields based on a primary key from the first table and two foreign keys in the second and output it to a single row. This working great but the output is spaced out based on column size. I have tried to comma delimit it using "||';'||" in the case statement but I keep getting a group by error. Can someone please help me get this into a comma delimited format.
Thanks.
select
distinct ft.serial_number, ft.state, ft.fap_version
,sum(case when rf_params_.id = ft.params_1x_fk then channel end) ox_channel
,sum(case when rf_params_.id = ft.params_1x_fk then pn_offset end) ox_pn_offset
,sum(case when rf_params_.id = ft.params_1x_fk then tx_power_dbm end) ox_power_dbm
,sum(case when rf_params_.id = ft.params_1x_fk then freq end) ox_freq
,sum(case when rf_params_.id = ft.params_do_fk then channel end) do_channel
,sum(case when rf_params_.id = ft.params_do_fk then pn_offset end) do_pn_offset
,sum(case when rf_params_.id = ft.params_do_fk then tx_power_dbm end) do_power_dbm
,sum(case when rf_params_.id = ft.params_do_fk then freq end) do_freq
from anpdb.femto ft
left join anpdb.rf_params rf_params_ on (ft.params_1x_fk = rf_params_.id) or (ft.params_do_fk = rf_params_.id)
left join hdm_dbuser.device hdev on hdev.serialnumber = ft.serial_number
where regexp_like(ft.state,'[2-9]') or ft.state = '10' and hdev.devicetype_id = '2' and hdev.deleted = '0'
group by
ft.serial_number, ft.state, ft.fap_version
order by fap_version;
Thanks.
select
distinct ft.serial_number, ft.state, ft.fap_version
,sum(case when rf_params_.id = ft.params_1x_fk then channel end) ox_channel
,sum(case when rf_params_.id = ft.params_1x_fk then pn_offset end) ox_pn_offset
,sum(case when rf_params_.id = ft.params_1x_fk then tx_power_dbm end) ox_power_dbm
,sum(case when rf_params_.id = ft.params_1x_fk then freq end) ox_freq
,sum(case when rf_params_.id = ft.params_do_fk then channel end) do_channel
,sum(case when rf_params_.id = ft.params_do_fk then pn_offset end) do_pn_offset
,sum(case when rf_params_.id = ft.params_do_fk then tx_power_dbm end) do_power_dbm
,sum(case when rf_params_.id = ft.params_do_fk then freq end) do_freq
from anpdb.femto ft
left join anpdb.rf_params rf_params_ on (ft.params_1x_fk = rf_params_.id) or (ft.params_do_fk = rf_params_.id)
left join hdm_dbuser.device hdev on hdev.serialnumber = ft.serial_number
where regexp_like(ft.state,'[2-9]') or ft.state = '10' and hdev.devicetype_id = '2' and hdev.deleted = '0'
group by
ft.serial_number, ft.state, ft.fap_version
order by fap_version;