Can the SQL be optimized without changing the table structure (too inefficient)

SELECT DISTINCT
    GROUP_CONCAT(
        DISTINCT pch.erpContractNumber
    ) AS fbk22,
    poh.*, IFNULL(eei.shortName, eei.fullName) AS companyShortName,
    GROUP_CONCAT(DISTINCT poi.fbk7) AS materialNumber
FROM
    purchase_order_header poh
LEFT JOIN purchase_order_item poi ON poh.purchaseOrderNumber = poi.purchaseOrderNumber
AND poh.elsAccount = poi.elsAccount
LEFT JOIN els_enterprise_info eei ON eei.elsAccount = poh.toElsAccount
LEFT JOIN purchase_contract_head pch ON pch.elsAccount = poh.elsAccount
AND poh.purchaseOrderNumber = pch.erpContractNumber
AND pch.fbk15 = "1"
WHERE
    poh.elsAccount = "120000"
AND poh.orderStatus IN ("0","1","2","3","4","5","6","7")
AND poh.orderSendStatus IN ("0")
GROUP BY
    poh.purchaseOrderNumber
ORDER BY
    poh.logtime DESC,
    poh.purchaseOrderNumber DESC
Mar.28,2021

join table queries are used as little as possible

in also eats resources and uses less

it is difficult to optimize the fixed table structure

Menu