Hey guys I just noticed that my join statement here
SELECT *
FROM reports rpt
JOIN (
(SELECT report_key, shipper, po, commodity, label
FROM berries)
UNION
(SELECT report_key, shipper, po, commodity, label
FROM melons)
UNION
(SELECT report_key, shipper, po, commodity, label
FROM citrus)
UNION
(SELECT report_key, shipper, po, commodity, label
FROM table_grapes)
UNION
(SELECT report_key, shipper, po, commodity, label
FROM tree_fruit)
UNION
(SELECT report_key, shipper, po, commodity, label
FROM lot)
) fruits ON rpt.inspection_number = fruits.report_key
WHERE rpt.status < '2'
ORDER BY rpt.inspection_number DESC
is returning each row where the query meets the condition, what I was after was trying to
get it to return ONE row, what did I do wrong?
You can add a
limit nclause to the end to get it to only return one row:This will return the first row.