I have a sql query compose of 56k lines. You may find the summary of it in the below. I like to parse the sql query into multiple ones. I've tried sqlparse and some other methods, however those would'nt helped. I think it's because there are so many subqueries in my main query and no seperator like (;).
Any help would be appreciated!
/* Formatted on 14/09/2022 08:03:20 (QP5 v5.256.13226.35538) */
SELECT t1.title,
t1.emp_name,
t1.emp_surname,
c1.fee,
(SELECT m.average_prc
FROM market m
WHERE m.title = t1.title)
market_price
FROM employees t1, costs c1
WHERE t1.emp_name = t2.emp_name
GROUP BY t1.title, t1.emp_name
UNION ALL
SELECT t1.title,
t1.emp_name,
t1.emp_surname,
c1.fee,
(SELECT m.average_prc
FROM engineers m
WHERE m.title = t1.title
UNION ALL
SELECT t.average_prc
FROM teachers t
WHERE t.title = t1.title)
market_price
FROM employees_engineers t1, costs c1
WHERE t1.emp_name = t2.emp_name
GROUP BY t1.title, t1.emp_name
/* this is just summary, it has many lot tables and columns */