squiggle-sql
squiggle-sql copied to clipboard
Querstion: Support for UNION ALL and LEFT OUTER JOIN ON for SAP HANA
Do you support UNION and LEFT OUTER JOIN ON as well?
We are working with SAP HANA.
We have quite complex SQLs to create views driven by a config file. See here an example.
select a1.subject_uuid, a2.DT, measure_type, measure_value, measure_unit from
(select distinct subject_uuid from clinical_audit_record where item_oid = 'VS_H_SCN.WEIGHT') as a1
left outer join
(select subject_uuid, item_value as DT
from clinical_audit_record where item_oid = 'VS_H_SCN.VS_DT' and audit_subcategory_name = 'Entered') as a2
on a1.subject_uuid = a2.subject_uuid
left outer join
(select subject_uuid, 'VS_H_SCN.WEIGHT' measure_type, item_value as measure_value
from clinical_audit_record where item_oid = 'VS_H_SCN.WEIGHT' and audit_subcategory_name = 'Entered') as a3
on a1.subject_uuid = a3.subject_uuid
left outer join
(select subject_uuid, item_value as measure_unit
from clinical_audit_record where item_oid = 'VS_H_SCN.WEIGHT_UNIT' and audit_subcategory_name = 'Entered') as a4
on a1.subject_uuid = a4.subject_uuid
union all
select a1.subject_uuid, a2.DT, measure_type, measure_value, measure_unit from
(select distinct subject_uuid from clinical_audit_record where item_oid = 'VS_H_SCN.SYSBP') as a1
left outer join
(select subject_uuid, item_value as DT
from clinical_audit_record where item_oid = 'VS_H_SCN.VS_DT' and audit_subcategory_name = 'Entered') as a2
on a1.subject_uuid = a2.subject_uuid
left outer join
(select subject_uuid, 'VS_H_SCN.SYSBP' measure_type, item_value as measure_value, 'mmHg' measure_unit
from clinical_audit_record where item_oid = 'VS_H_SCN.SYSBP' and audit_subcategory_name = 'Entered') as a3
on a1.subject_uuid = a3.subject_uuid
There is no support for unions ATM. A fix for you is to build separate queries with squiggle and concatenate them with a string builder and the desired union.