Привет, ребята, так что мой запрос не возвращает мои результаты объединения, когда я задаю имена столбцов в main main, aka
SELECT inspection_number, region, report_date,
inspection_type AS type, customer, customer_number, shipper, po
FROM reports
JOIN (
(
SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
FROM `berries`
)
UNION (
SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
FROM `melons`
)
UNION (
SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
FROM `citrus`
)
UNION (
SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
FROM `table_grapes`
)
UNION (
SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
FROM `tree_fruit`
)
UNION (
SELECT `key`, `report_key`, `shipper`, `po`, `commodity`, `label`, `status`
FROM `lot`
)
) fruits ON inspection_number = fruits.report_key
WHERE fruits.status = '0' OR fruits.status = '1'
ORDER BY report_date DESC
Не возвращает key
, report_key
, shipper
, po
, commodity
, label
или status
Странно работает
SELECT *
inspection_type AS type, customer, customer_number, shipper, po
FROM reports
JOIN ( -- etc.....
Will? Как я могу это исправить?