SELECT b.title, i.barcode
FROM biblio b
JOIN items i
ON b.biblionumber= i.biblionumber
Join biblioitems bi
ON i.biblionumber=bi.biblionumber
where i.barcode IN (4088,6183,6191)
above SQL given results as below,
how do I get results in IN (4088,6183,6191) as entered order
SELECT b.title, i.barcode
FROM biblio b
JOIN items i ON b.biblionumber = i.biblionumber
JOIN biblioitems bi ON i.biblionumber = bi.biblionumber
WHERE i.barcode IN (4088, 6183, 6191)
ORDER BY FIELD(i.barcode, 4088, 6183, 6191);
2
Answers
You can try below modified Query.
Hope this helps!!
You can use the
ORDER BY
withCASE
statement :