Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sql error

missing parenthiss error any ideas

sql select
fac1, moa1, age_group1,
to_char((moapres/moatot) * 100,'900.00') || '%' moa,
to_char((facpres/factot) * 100,'900.00') || '%' fac,
to_char((agepres/agetot) * 100,'900.00') || '%' age,
to_char((fac_agepres/fac_agetot) * 100,'900.00') || '%' fac_age,
to_char((moa_facpres/moa_factot) * 100,'900.00') || '%' moa_fac,
to_char((moa_agepres/moa_agetot) * 100,'900.00') || '%' moa_age,
to_char((moa_fac_agepres/moa_fac_agetot) * 100,'900.00') || '%' moa_fac_age,
to_char((totpres/tottot) * 100,'900.00') || '%' tot
from (
select distinct
faculty fac1,moa moa1,age_group age_group1,
sum(sumoftotal) over(partition by moa) moatot,
sum(sumoftotal) over(partition by faculty) factot,
sum(sumoftotal) over(partition by age_group) agetot,
sum(sumoftotal) over(partition by faculty, age_group) fac_agetot,
sum(sumoftotal) over(partition by moa, faculty) moa_factot,
sum(sumoftotal) over(partition by moa, age_group) moa_agetot,
sum(sumoftotal) over(partition by moa, faculty, age_group) moa_fac_agetot,
sum(sumoftpres) over(partition by moa) moapres,
sum(sumoftpres) over(partition by faculty) facpres,
sum(sumoftpres) over(partition by age_group) agepres,
sum(sumoftpres) over(partition by faculty, age_group) fac_agepres,
sum(sumoftpres) over(partition by moa, faculty) moa_facpres,
sum(sumoftpres) over(partition by moa, age_group) moa_agepres,
sum(sumoftpres) over(partition by moa, faculty, age_group) moa_fac_agepres,
sum(sumoftpres) over() totpres,
sum(sumoftotal) over() tottot
from (
SELECT nvl(depts.faculty,uio.offering_organisation) faculty, CASE WHEN uio.FES_MOA_CODE !='01' THEN 'PT' ELSE 'FT' END moa,
Sum(src.total) SumOfTOTAL, Sum(src.tpres) SumOfTPRES, src.age_group
FROM
(SELECT Sum(rss.tpres) tpres, Sum(rss.total) total,
annual_constants.age_group(2,annual_constants.age_cy(p.date_of_birth)) age_group,
rss.sbj_code_p, rss.cal_occ_p cal_occ_p
FROM
reg_stu_stats rss
join people p ON rss.person_code = p.person_code
WHERE
rss.cal_occ_p LIKE '09%'
GROUP BY annual_constants.age_group(2,annual_constants.age_cy(p.date_of_birth)),
rss.sbj_code_p, rss.cal_occ_p
having sum(rss.total) != 0 -- 04/11/09 PC - removed sum(rss.tpres) != 0
) src
join unit_instance_occurrences uio ON uio.fes_uins_instance_code = sbj_code_p
AND uio.calocc_occurrence_code = cal_occ_p
join unit_instances ui ON uio.fes_uins_instance_code = ui.fes_unit_instance_code
left join (
select primary_organisation,
secondary_organisation,
ou1.fes_full_name FACULTY,
ou2.fes_full_name DEPT
from org_unit_links
join organisation_units ou1 on ou1.organisation_code = primary_organisation
join organisation_units ou2 on ou2.organisation_code = secondary_organisation
where ou1.ORGANISATION_TYPE = 'F'
) depts on uio.OFFERING_ORGANISATION = depts.secondary_organisation
GROUP BY nvl(depts.FACULTY,uio.offering_organisation), CASE WHEN uio.FES_MOA_CODE !='01' THEN 'PT' ELSE 'FT' END, src.age_group
)
)

2 Replies
rbecher
MVP
MVP

Hi Matthew,

is this statement working on Oracle?

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
rbecher
MVP
MVP

This inline comment could be a problem:

-- 04/11/09 PC - removed sum(rss.tpres) != 0 -- 04/11/09 PC - removed sum(rss.tpres) != 0


- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine