I want to retrieve First and Last Row using client_id from my table. So I wrote this which threw an error (1241), Can Anyone please tell me what this issue with this code :
SELECT *
FROM invoices
WHERE invoice_id IN (SELECT MAX(invoice_id),
MIN(invoice_id)
FROM invoices
);
WHERE AS this code is perfectly fine :
SELECT *
FROM invoices
WHERE invoice_id IN (SELECT MIN(invoice_id)
FROM invoices
UNION SELECT MAX(invoice_id)
FROM invoices
);