Reputation: 693
I have the following MySQL statement that runs correctly in MySQL workbench:
SELECT *, max(invoiceDate)
AS latestDate
FROM goodsreceiptrecords
WHERE (productKey, productIdentifier2)
IN ((23,'Master'),(28,'Local'),(18,'Local'),(19,'Local')) AND unitPrice > 0
GROUP BY productKey, productIdentifier1, vendorKey, storeType;
I tried using the same syntax for SQLITE but I am getting an error messase of:
sqlite3_prepare_v2 failure: row value misused
What would be the correct syntax for this SELECT statement in MySQL? Basically, What I am trying to do is select records that matches the values of 2 columns from the table
Upvotes: 0
Views: 784
Reputation: 180161
The documentation says:
For a row-value IN operator, the left-hand side (hereafter "LHS") can be either a parenthesized list of values or a subquery with multiple columns. But the right-hand side (hereafter "RHS") must be a subquery expression.
But a VALUES clause can replace a subquery, so just use:
...
WHERE (productKey, productIdentifier2)
IN (VALUES(23,'Master'),(28,'Local'),(18,'Local'),(19,'Local'))
...
Upvotes: 1