找出sql错误SELECT
*
FROM
(
SELECT
a.id,
a.CODE AS 'sourceBillCode',
a.type AS 'originalOrderType',
a.unit_of_origin,
a.unit_of_origin_type,
a.time AS 'orderOriginCreationTime',
a.warehouse,
a.receiving_storage_space,
b.type_of_material,
b.quality_control_number,
b.good_products_number,
b.defective_products_number,
b.yield,
b.quantity_of_returns,
b.as_received_condition,
b.quantity_of_order,
b.quantity_not_received,
b.quantity_of_goods_received,
b.number_of_spare_parts,
b.quantity_of_returns_actual,
b.special_production_quantity,
b.quantity_in_storage,
b.receipt_quantity AS 'inqty',
b.quantity_not_in_storage
FROM
wareh_source_order a
LEFT JOIN statistics_receiving_order b ON a.id = b.order_id UNION ALL
SELECT
a.id,
a.CODE AS 'sourceBillCode',
a.type AS 'originalOrderType',
a.unit_of_origin,
a.source_of_delivery_note,
a.time AS 'orderOriginCreationTime',
a.warehouse,
a.receiving_storage_space,
b.type_of_material,
b.quality_control_number,
b.good_products_number,
b.defective_products_number,
b.yield,
b.quantity_of_returns,
b.as_received_condition,
b.quantity_of_order,
b.quantity_not_received,
b.quantity_of_goods_received,
b.number_of_spare_parts,
b.quantity_of_returns_actual,
b.special_production_quantity,
b.quantity_in_storage,
b.receipt_quantity AS 'inqty',
b.quantity_not_in_storage
FROM
wareh_source_order a
LEFT JOIN statistics_purchase_order b ON a.id = b.order_id
) tab
WHERE
originalOrderType IN ( 'PurchaseOrder', 'ReceiptRecord' )
AND warehouse = 'string'
AND receiving_storage_space = 'string'
AND date_format( orderOriginCreationTime, '%y%m%d' ) >= date_format( '2023-07-07 00:00:00.0', '%y%m%d' )
AND date_format( orderOriginCreationTime, '%y%m%d' ) <= date_format( '2023-07-07 00:00:00.0', '%y%m%d' )
AND (
EXISTS (
SELECT
material_no
FROM
wareh_source_order_list c
WHERE
c.order_id = id
AND ( c.material_name REGEXP 'string' OR c.material_full REGEXP 'string' OR c.material_lot REGEXP 'string' )
)
OR source_of_delivery_note REGEXP 'string'
OR CONVERT ( source_bill_code USING utf8mb4 ) REGEXP 'string'
)