I am unable to retrieve rows with repeated IDs using SELECT IN
ID column is Primary key with auto increment.
SELECT ID FROM dbproduct WHERE ID IN (3,2,1,4,3,2,1,4);
I get the following result back
ID
-----
1
2
3
4
------
Other than that it doesnt seem to be displaying result in the order it was sent.
Im looking for a query to get the desired result is this
ID
-----
3
2
1
4
3
2
1
4
------
cpsrvd 11.86.0.27
Database client version: libmysql – 5.6.43
PHP version: 7.3.6
2
Answers
You can put these numbers in a derived table first (along with their sequence in the list), then join:
You can update mysql to Ver 8.0.21. It’s work.